Monday, May 29, 2006

Display confirm message

In windows application, when user want to delete something on forms. A message box'll appear, so if user really want to delete they must comfirm this action again. In ASP.NET we can easy do the same by two ways:
1. Register confirm action inside the PreRender event. It'll register the javascript in the client side so it'll operate when user click on the button
private void Page_PreRender(object sender, EventArgs e)
{
btnDelete.Attributes.Add("OnClick", "return confirm('Do you really want to delete this row? No undo action is available')");
}
2. We can add "OnClientClick" event at HTML code like this:

Hope this help you!!!




(








)

Anything else is the same as the traditional code

1 comment:

Name Company said...

http://siphu.wordpress.com/2006/04/18/display-confirm-message/#comments

Locations of visitors to this page
DROP ME A MSG :D