How to Post back page from Client side code?

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
 
O

Onin Tayson

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!
 
N

Niraj Ranka

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top