public void btnconsulta_Click(object sender, EventArgs e)//Guardar { DataTable dt = Session["Tabla"] as DataTable; if (dt.Rows.Count == 0) { ahora = "nada en tabla"; } else { foreach (GridViewRow row in Gridviewpermisos.Rows) { string serialtemp = row.Cells[1].Text; string dat = ahora; string test = serialtemp; string[] palabras = test.Split('/'); string idpermiso = palabras[0]; string nombrepermiso = palabras[1]; string[] Datorol = Selectrol.Value.Split('/'); string idrol = Datorol[0]; string nombrerol = Datorol[1]; //aqui ingresamos el famoso asigarticulo String bd = Session["BD"].ToString(); try { var valida = sb.Ccreapermiso(idpermiso, idrol, Session["USUARIO"].ToString(), bd); if (valida.Rows.Count > 0) { excepcion.Visible = false; notificacion.Visible = true; txtnotifica.InnerText = "Registro Exitoso"; } else { notificacion.Visible = false; excepcion.Visible = true; error.InnerText = "Error al Guardar"; } } catch (Exception exp) { notificacion.Visible = false; excepcion.Visible = true; string dato = exp.Message; error.InnerText = dato; } } string script = @"<script type='text/javascript'> alert('Guadado con exito'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); } }