Javascript Confirmation Box on client click

Show confirmation box on any linkbutton or button

Many a times we need to present user a confirmation box before executing server side code so that user get a chance to proceed further or return back.(eg. on delete button or linkbutton).
This can be done very easily. In the properties for the user control like button, linkbutton etc simply put

OnClientClick="return confirm('This will delete records permanently. Are you Sure?');"

Clicking Cancel will return back and clicking Ok will execute the server side code.

Anand Deo


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: