ASP tutorial. NET Delete Confirmation prompt box
protected void Gv_rowdatabound (object sender, GridViewRowEventArgs e)
{
if (E.row.rowtype = = Datacontrolrowtype.datarow)
{
LinkButton lb = E.row.findcontrol ("Lnkbtndelete") as LinkButton;
Lb.attributes.add ("onclick", "return confirm (' OK to delete? ')");
}
}
Method Two
<asp:button onclientclick= "Retrun confirm (' OK to delete? ')" ></asp:button>
Method Three
In the background code: Btn.attributes.add ("onclick", "Web Effects: Return confirm (' OK delete ')")
Or
Receptionist Code onclientclick= "return confirm (' delete ')";
Method Four
On the Delete button, add: onclientclick= "Javascript:return confirm (' Delete?? ') ', name= "Delete"
protected void Gridview_rowdeleting (object sender, Gridviewdeleteeventargs e)
{
if (e.commandname== "Delete"
{
EXECUTE DELETE statement!!!
}
}