Click "Delete" when pop-up "are you sure you want to delete?" ", OK after delete, cancel after return.
Source: Internet
Author: User
DataGrid Typegrid_delete () is the event that is triggered on the server when the Delete button is clicked
<script language= "JavaScript" >
<!--
function Deleteconfirm ()
{
var quesition=window.confirm ("Are you sure you want to delete it?") ");
if (quesition==true) {from1.submit (); Typegrid_delete (); return true;}
}
-->
</script>
Then put the button on the onclick event as follows:
<asp:buttoncolumn headertext= Delete "commandname=" delete "text=" "/>
This will do, no need to pass any parameters.
My practice is to write in the ItemDataBound incident:
If e.item.itemindex >= 0 Then
' Pop-up Confirm dialog box
CType (E.item.cells (i). FindControl ("Btndel"), button). Attributes ("onclick") = "Javascript:return window.confirm" (' Really want to delete it? ');"
End If
Where I is the first column-1, the deletion button inside the template column id= "Btndel"
Add the code to the display page;
<script language= "JavaScript" >
function Delete_confirm (e)
{
if (Event.srcElement.outerText = = "Delete")
Event.returnvalue =confirm ("will not be recoverable after deletion, are you sure you want to delete it?") ");
}
document.onclick=delete_confirm;
</script>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.