protected void Page_Load(object sender, EventArgs e) { oWeb.ValidaSessionAdm(); if (!IsPostBack) { CodKpi.Value = oWeb.GetData("CodKpi"); if (!string.IsNullOrEmpty(CodKpi.Value)) { DBConn oConn = new DBConn(); if (oConn.Open()) { cAppKpi oAppKpi = new cAppKpi(ref oConn); oAppKpi.CodKpi = CodKpi.Value; DataTable dtKpi = oAppKpi.Get(); if (dtKpi != null) { if (dtKpi.Rows.Count > 0) { txt_nombre.Text = dtKpi.Rows[0]["nombre_kpi"].ToString(); txt_identificador.Text = dtKpi.Rows[0]["identificador_kpi"].ToString(); oCmbEstado.Items.FindByValue(dtKpi.Rows[0]["estado_kpi"].ToString()); } } dtKpi = null; } oConn.Close(); } } }
protected void LoadGrid() { DBConn oConn = new DBConn(); if (oConn.Open()) { cAppKpi oAppKpi = new cAppKpi(ref oConn); if (!string.IsNullOrEmpty(txtKpi.Text)) { oAppKpi.NombreKpi = txtKpi.Text; } gridKpi.DataSource = oAppKpi.Get(); gridKpi.DataBind(); oConn.Close(); } }