On deleting of row of datagrid a delete msg popup
Any one can help me
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Amit MRank #3,390 · 425 reputationPosted Oct 9, 2007, 4:47 AM EDT
just add javascript function onclick of ur row deletion button.
like this
if(confirm("do you want to delete this row")) //this will open popup up message with two button ok/cancel if user cick ok then browser will do trip for deletion otherwise on cancel it will not make trip
{retunr true; }
else
{
return false;
}
Amit MRank #3,390 · 425 reputationPosted Oct 9, 2007, 4:48 AM EDT
just add javascript function onclick of ur row deletion button.
like this: add this code in one javascript function
if(confirm("do you want to delete this row")) //this will open popup up message with two button ok/cancel if user cick ok then browser will do trip for deletion otherwise on cancel it will not make trip
{retunr true; }
else
{
return false;
}
Blocked AccountRank #403 · 6.2K reputationPosted Oct 10, 2007, 3:41 AM EDT
Use This code snippet.
protected
void GridView_RowDataBound(object sender, GridViewRowEventArgs e){
if (e.Row.RowType == DataControlRowType.DataRow)
{
ImageButton imageButton = (ImageButton)e.Row.FindControl("ImageButton1");
imageButton.Attributes.Add("onclick", "javascript:return " +"confirm('Are you sure you want to
delete this record. " +"')");
}
} protected void GridView_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
// write code for the deletion
}
}
protected void GridView_RowDeleting(object sender, GridViewDeleteEventArgs e){
}