First add a new Web Form to your Webapplication and drag a .NET Button control on the form. We will name the Text property of this Button Control "Delete" and go to the codebehind of the Page.
Add the following code in the Page_Load event:
Button1.Attributes.Add("onClick", "return confirm('Are you sure?');")
Now run the application and click on the Delete button. The user will be prompted with a nice client-side confirmation box.
When the user clicks cancel the Form will not be posted back to the server. This will only happen when the user clicks the OK button.
No comments:
Post a Comment