Confirmation box for asp tutorial. net deletion
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 ('Are you sure you want to delete it? ')");
}
}
// Method 2
<Asp: button onclientclick = "retrun confirm ('Are you sure you want to delete it? ') "> </Asp: button>
// Method 3
Use the background code btn. attributes. add ("onclick", "webpage special effect: return confirm ('Are you sure you want to delete ')")
Or
Front-end code onclientclick = "return confirm ('delete ')";
// Method 4
Add onclientclick = "javascript: return confirm ('delete ?? ') ", Name =" delete"
Protected void gridview_rowdeleting (object sender, gridviewdeleteeventargs e)
{
If (e. commandname = "delete"
{
Run the delete statement !!!
}
}