CONFIRMATION OF DELETE BUTTON IN GRID

Labels: ,

private void grd_ItemDataBound(object sender,System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.FindControl("Delete") != null)
{

((LinkButton) e.Item.FindControl("Delete")).Attributes.Add("onClick", "return confirm('Are you sure to delete this item?');");;

}
}

findcontrol() method searches the current naming container for a server control with the specified id parameter.using the findcontrol we find the delete link button and give the confirmation box using javascript when the button in the grid is clicked.

0 comments:

Post a Comment