Execute a CodeBehind function from a javascript

G

Guest

Here is my problem. I have a delete record button. I want to prompt the user "Do you really want to delete?". If the user clicks 'OK' then I want to execute the CodeBehind on the server side to accomplish this. How do I do this

I think the HtmlButton is probably the desired method. But, how do I get the client side javascript to execute the desired (when needed) the server side codebehind function?
 
G

Guest

Michael

You can do this by attatching an attribute to your server side button

In your code behind(Page_Load method)

btnDelete.Attributes.Add("onclick", "return alert('Do you really want to delete?')")

Suresh

----- Michael SL wrote: ----

Here is my problem. I have a delete record button. I want to prompt the user "Do you really want to delete?". If the user clicks 'OK' then I want to execute the CodeBehind on the server side to accomplish this. How do I do this

I think the HtmlButton is probably the desired method. But, how do I get the client side javascript to execute the desired (when needed) the server side codebehind function?
 

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,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top