Groups | Blog | Home
all groups > asp.net webcontrols > march 2007 >

asp.net webcontrols : Make a server side but put up a Confirm MsgBox


Rod
3/12/2007 3:40:47 PM
I have a server side button that deletes something. I want to put up a
Confirm MsgBox that says "Do you really want to delete this?"
I know how to make a client side button put up this message but I can't see
how to get a server side button to do it.

Many thanks in advance
Rod


David Longnecker
3/12/2007 4:20:13 PM
In your code behind, you can still use JavaScript.

Given you have a button object called btnDelete:

Add the following to your Page_Load.

btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want
to delete?');");

-dl

---
David Longnecker
Web Developer
http://blog.tiredstudent.com

[quoted text, click to view]

Rod
3/12/2007 4:42:42 PM
Easy when you know how.

thanks




[quoted text, click to view]

AddThis Social Bookmark Button