protected void btnReg_Click(object sender, ImageClickEventArgs e) { string cleanMessage = string.Empty; int intContador = 0; foreach (GridViewRow Fila in GridView1.Rows) { CheckBox ChkBoxCell = ((CheckBox)Fila.FindControl("chkSelect")); if (ChkBoxCell.Checked == true) { intContador += 1; } } if (intContador == 0) { cleanMessage = "Debe seleccionar al menos un registro."; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } foreach (GridViewRow row in GridView1.Rows) { //TextBox txt; string Reqs_ItemSecuencia = GridView1.DataKeys[row.RowIndex].Values["Reqs_ItemSecuencia"].ToString(); // extrae key CheckBox ChkBoxCell = ((CheckBox)row.FindControl("chkSelect")); BL_TBL_RequerimientoSubDetalle obj = new BL_TBL_RequerimientoSubDetalle(); DataTable dtResultado = new DataTable(); if (ChkBoxCell.Checked) { dtResultado = obj.USP_UPDATE_REGULARIZACION_EQUIPO_MENOR(Reqs_ItemSecuencia, "2"); } else { dtResultado = obj.USP_UPDATE_REGULARIZACION_EQUIPO_MENOR(Reqs_ItemSecuencia, "1"); } ChkBoxCell = null; } if (intContador > 0) { //Listar("", "", "", "", "", "", ""); //ScriptManager.RegisterStartupScript(this, typeof(Page), "myScript", "gridviewScroll();", true); cleanMessage = "Actualización satisfactoria"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); ScriptManager.RegisterStartupScript(this, typeof(Page), "myScript", "gridviewScroll();", true); } }