Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to delete the record from a data grid and i am looking for a confirmation popup when the delete button is clicked. The confirmation pop up contains Yes or No. Yes will delete the record and No will cancel the process.

can we use
ScriptManager.RegisterStartupScript(this, this.GetType(), "Jscript2", "alert('Are you sure you want to delete this record!');", true);


for same yes or no popup ?

Please assist
Thanks in advance.

What I have tried:

if (e.CommandName == "DelDetails")
{
    ScriptManager.RegisterStartupScript(this, this.GetType(), "Jscript2", "alert('Are you sure you want to delete this record!');", true);

    GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
    Label lbldeleteid = rowSelect.FindControl("lbl_StarId") as Label;

    string str_Incident_Number_delete = lbldeleteid.Text.ToString();

    SqlConnection con = new SqlConnection(cs);
    con.Open();
    SqlCommand cmd = new SqlCommand("delete from Workflow where ID ='" + str_Incident_Number_delete + "'", con);
    cmd.ExecuteNonQuery();
    con.Close();

    ShowOpMatData(1);
    Refresh();
}
Posted
Updated 15-Jan-18 21:39pm
v2
Comments

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900