foreach (GridViewRow gvrow in gvuserdetails1.Rows) { //Finiding checkbox control in gridview for particular row CheckBox chkdelete = (CheckBox)gvrow.FindControl("chkdelete"); //Condition to check checkbox selected or not if (chkdelete.Checked) { //Getting UserId of particular row using datakey value int usrid = Convert.ToInt32(gvuserdetails1.DataKeys[gvrow.RowIndex].Value); objusers.DeleteParameters["UserId"].DefaultValue = usrid.ToString(); objusers.Delete(); }
gvuserdetails1.DataKeys
gvrow.RowIndex
CheckBox chk = (CheckBox)gvrow.Cells[index value of checkbox column].FindControl("chkdelete");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)