I need to add a confirm pop up to basically a “delete” command.
I try to use a simple way, just add an "attribute" in the cells.
e.Row.Cells(4).Attributes.Add("onClick", "return confirm('Are you sure you want to delete the record?');")
but it cannot work~ (btw, I used the image ButtonType)
This time I ended up writing my own TemplateField. In add a onClientClick attribute. This will call your Javascript function and display a confirm popup to your users.
<asp:imagebutton id="btnDelete" runat="server" commandname="Delete" onclientclick="return confirmSubmit();" imageurl="~/images/i_delete.gif" text="Delete">
Here is the basic Javascript code to pop up a confirm button.
<SCRIPT LANGUAGE="JavaScript">
function confirmSubmit() {
var agree=confirm("Do you really want delete in the database?");
if (agree)
return true ;
else
return false ;
}
</SCRIPT>


1 comments:
November 07, 2009 1:57 PM
I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!
Sorry for offtopic
Post a Comment