Since we are not allowed to add the client-side function in the onClick event declaratively, therefore, in the ItemDataBound or the ItemCreated event of the DataGrid, add these lines if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { if( e.Item.FindControl("lbtnDelete") !=null) { LinkButton lbtnDelete = (LinkButton)e.Item.FindControl("lbtnDelete"); lbtnDelete.Attributes.Add("onclick","return confirm('The record selected will be deleted permanently. Are you sure you wish to delete this merchant?');"); } }

For the DeleteCommand event,

public void dgrd_DeleteCommand(Object sender, DataGridCommandEventArgs e){ // use the findcontrol to get the value of the textbox // and do your deletion operation here}