protected void BtnAsigRutas_Click(object sender, EventArgs e) { logClass = new LogClass(); if (GridAsingRutas.Rows.Count > 0) { int y = 0; foreach (GridViewRow row in GridAsingRutas.Rows) { var checkbox = row.FindControl("CheckBAsigRutas") as CheckBox; if (checkbox.Checked) { y++; } } if (y > 0) { foreach (GridViewRow row in GridAsingRutas.Rows) { var checkbox = row.FindControl("CheckBAsigRutas") as CheckBox; if (checkbox.Checked) { string IdAsignRuta = GridAsingRutas.DataKeys[row.RowIndex].Value.ToString(); bool Insert = logClass.InsertAsignoperario(IdAsignRuta, DDListUsuario.SelectedValue); } } TokenClass token = new TokenClass(); Response.Redirect("~/View/Logistica/AdministracionUsuarios?ID=" + HdnIdInventario.Value + "&TOKEN=" + token.TokenId); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "none", "<script> $(document).ready(alert('No se ha seleccionado ninguna ruta'));</script>", false); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "none", "<script> $(document).ready(alert('No se ha seleccionado ruta'));</script>", false); } }