• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

Confirmation Box Handling in ASP.NET

I have been having difficulty developing a nice implementation of a confirmation box for an ASP.NET application.  My latest attempt is to have my ASP.NET code register a JavaScript to handle the confirmation box.  This works fine, but so far I have been unable to find a clever way of returning the user's response to the confirmation box to the ASP.NET code.

I found an example that uses JavaScript's __doPostBack method to generate the postback I need to capture.  However, I am not familiar with this procedure.  Ideally, I'd like to use it to generate a specific postback for a control event (like a hidden button press).  This would give me all the knowledge I would need from the confirmation box script to reat properly to the user's response.

I assume this is a common hurdle in server-side web apps.  Surely there must be a simple trick to achieve what is necessary.

Please let me know if you're familiar with this __doPostBack trick or if there is some other method to communicate the result of the JavaScript confirm box back to the server-side code.

2 Solutions
The only way to do this is like on the client side, for example if you are handling some delete confermation acction you have to do it on the client side with javascript end if user doesn't wants do delete the record or whatever you just return false so that you abort postback, or if user confirms deletion you return true and you receive postback so that ypou can handle deletion!
Mohammed NasmanSoftware DeveloperCommented:

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now