<asp:gridview id="GridView1" runat="server" autogeneratecolumns="False" datakeynames="id" datasourceid="SqlDataSource1" onrowdatabound="GridView1_RowDataBound">
<columns>
<asp:commandfield showdeletebutton="True" />
<asp:boundfield datafield="id" headertext="id" readonly="True" sortexpression="id" />
<asp:boundfield datafield="name" headertext="name" sortexpression="name" />
</columns>
</asp:gridview>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Button delete = e.Row.Cells[0].Controls[0] as Button;
delete.Attributes.Add("onclick","return confirm('Are you sure you want to delete?');");
}
}
Refer this too:
GridView Delete, with Confirmation[
^]
Regards :laugh: