private void dtgConceptosGastos_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { /*this.dtgConceptosGastos.EditItemIndex = -1; * Session["dsGastosAgencia"] = null; * this.BindGrilla(); * * this.dtgConceptosGastos.DataSource = (DsGastosAgencias) Session["dsGastosAgencia"]; * this.dtgConceptosGastos.EditItemIndex = e.Item.ItemIndex; * this.dtgConceptosGastos.DataBind();*/ /*RequiredFieldValidator req = (RequiredFieldValidator) ((PlaceHolder)e.Item.FindControl("phValidImporte")).FindControl("ReqGastoImporte"); * req.Enabled = true; * req.Validate(); * if (!req.IsValid) * return; * * * BaseValidator valImp = (BaseValidator) ((PlaceHolder)e.Item.FindControl("phValidImporte")).FindControl("ValGastoImporte"); * valImp.Enabled = true; * valImp.Validate(); * if (!valImp.IsValid) * return;*/ Page.Validate(); if (!Page.IsValid) { return; } this.dsGastosAgencia = (DsGastosAgencias)Session["dsGastosAgencia"]; DsGastosAgencias.DatosRow dr = (DsGastosAgencias.DatosRow) this.dsGastosAgencia.Datos.Rows[e.Item.DataSetIndex]; IGastoAgencia gastoAgencia = GastoAgenciaFactory.GetGastoAgencia(); gastoAgencia.AgenciaID = Convert.ToInt32(this.txtAgenciaID.Text); gastoAgencia.GastoAgenciaID = dr.GastoAgenciaID; gastoAgencia.GastoImporte = dr.GastoImporte; gastoAgencia.ConceptoGastoID = dr.ConceptoGastoID; try { if (gastoAgencia.Guardar()) { this.dtgConceptosGastos.EditItemIndex = -1; Session["dsGastosAgencia"] = null; this.BindGrilla(); } else { string script = "<script language='javascript'>\n"; script += "alert('Los datos no se guardaron debido a errores.');\n"; script += "</script>"; Page.RegisterStartupScript("scriptError", script); } } catch (Exception ex) { string mensaje = ex.Message; try { mensaje = this.TraducirTexto(ex.Message); if (mensaje == "" || mensaje == null) { mensaje = ex.Message; } } catch (Exception) { mensaje = ex.Message; } ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(mensaje); } }