Skip to content

Button Validation in c# & asp.net

Eshan

Asked Jan 24, 2006, 6:59 PM EST1 answer
Share
LinkedInX
I have a form build in asp.net and its code behind in c#.  I have a button delete and i need to prompt a message for the user when he is attempting to delete a record...(like: Are u sure to delete this record?) I am unable to do so.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    You need to add a javascript event handler : onclick. This can be done dynamically in your Page_Load method with something like this : this.commandDelete.Attributes.Add("onclick", "return confirm('Do you really want to delete this record?')"); and with that you can have your C# commandDelete_Click event handler. Simon
    0