How to Post back page from Client side code?

  • Thread starter Thread starter Ahmad Jalil Qarshi
  • Start date Start date
A

Ahmad Jalil Qarshi

Hi,

I am developing a website in ASP.NET. I want to have a client side code to
confirm the deletion of some information from backend database. I want to
use a Message Box have two buttons "Yes" and "No" to confirm the deletion.

Now I want if the user press "Yes" the page should be posted back to the
server to delete the information from database and do nothing when user
press "No" button means don't post back the page.

Anybody there to help me.

with best Regards,


Ahmad Jalil Qarshi
 
You can add an onClick attribute to your Button & handle the confirmation
using the confirm javascript method.

On your page load event:

YourButtonNameHere.Attributes.Add("onclick", "<script>return confirm('Do
you want to continue deleting the record(s)?');</script>");

That's all there is to it!
 
Hello,

Please add the javascript function to the onclik event on the button by
adding hte functioname in the attritubes on the button. like

buttonname.attributes.add("onclick",functionname)

And in the functio jsut write
functionanem
(
return confirm('do u want to delete');
)

It will work.

Regards
 
Back
Top