Hi,
I want to get confirmation from the user while deleting particular record from the GridView.
In code-behind, we can do this by inserting the javascript.This can be written in the RowDataBound Event(OnRowDataBound= sampleStudGridView_RowDataBound) of the GridView.
In Code-Behind,
protected void sampleStudGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
LinkButton deleteLinkButton = (LinkButton)e.Row.FindControl("deleteLinkButton");
if (deleteLinkButton != null)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
deleteLinkButton.Attributes.Add("onClick","javascript:return "+ "confirm('Are you sure you want to delete this record ? "+DataBinder.Eval(e.Row.DataItem,"sname")+"')");
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment