protected void gvSecciones_RowUpdating(object sender, GridViewUpdateEventArgs e) { SeccionArchivo sa = new SeccionArchivo(); Label txId = (Label)gvPoblaciones.Rows[e.RowIndex].FindControl("lbEditClave"); TextBox txtNombreSec = (TextBox)gvPoblaciones.Rows[e.RowIndex].FindControl("txEditNombre"); TextBox txtDescripcion = (TextBox)gvPoblaciones.Rows[e.RowIndex].FindControl("txEditDescripcion"); String Resultado = sa.Actualizar(int.Parse(txId.Text), txtNombreSec.Text.ToUpper(), txtDescripcion.Text.ToUpper()); gvSecciones.EditIndex = -1; gvSecciones.DataSource = main.Secciones.Catalogo(); gvSecciones.DataBind(); if (Resultado.Equals("OK")) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Datos actualizados Correctamente')", true); } }
protected void gvSecciones_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("AGREGAR")) { SeccionArchivo sa = new SeccionArchivo(); TextBox txtNombreSec = (TextBox)gvSecciones.FooterRow.FindControl("txNombreSeccion"); TextBox txtDescripcion = (TextBox)gvSecciones.FooterRow.FindControl("txDescripcion"); String Resultado = sa.GuardarNuevo(txtNombreSec.Text.ToUpper(), txtDescripcion.Text.ToUpper()); gvSecciones.DataSource = main.Secciones.Catalogo(); gvSecciones.DataBind(); if (Resultado.Equals("OK")) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Datos agregados Correctamente')", true); } } }