Sunday, September 18, 2005

Add Prompt on C# Webpage

When a user clicks a button, you probably want to confirm that they meant to click it. Especially if the button's Text is "Delete Database". Here's about the simplest check you could do:

myDeleteButton.Attributes.Add("onClick", "return confirm('Are you sure you wish to delete the database?');");

The user will see "Ok" and "Cancel". If the user doesn't choose 'Ok', the operation is canceled.

0 Comments:

Post a Comment

<< Home