When building a webapplication, have you ever wanted to display an alert asking a user whether he really, really wanted to delete some data?
In ASP.NET 2.0 this is made easy by the OnClientClick property on the button control.
Just enter the following JavaScript in the property and the user will have to confirm the action. If the user cancels, then the button will not perform a postback and the serverside event never even fires.
if (!confirm('Are you sure you want to delete this customer?')) return;
[11/27/2007] Update:
The code above will work if the button you're adding the OnClientClick to has UseSubmitBehavior="false" if not, then you should use:
if (!confirm('Are you sure you want to delete this customer?')) return false;
Being techno-savvy is good. For once, keeping up with innovations like wireless camera and making use of facilities like wireless routers is good and does pay off. However, that should not result in missing out on important practical issues like having a proper computer backup solution. While looking for a web hosting service, the feature that matters the most is the facility of online backup. People usually concentrate on other things like ip phones etc. However, unless the domain name registration is done with, this ignorance can be made up for.
dasBlog theme by Mads Kristensen
Concepts LINQ Entity Framework WCF WPF RESTful Web Unit Testing .NET Workflow More >>
Tools Visual Studio Windows IIS Silverlight More >>
Type Screencast Tools Video Newsletter Sample Article Books Magazine How To Demo Course Products More >>