protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <RetencPercepType> Retenciones = new List <RetencPercepType>(); List <CodRetType> Codigos = LCodRet.ListarCodRet(); Session["Codigos"] = Codigos; Session["Retenciones"] = Retenciones; BindData(); } }
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { GridView1.EditIndex = e.NewEditIndex; string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); BindData(); DropDownList ddlCodRet = GridView1.Rows[e.NewEditIndex].FindControl("ddlCodRet") as DropDownList; if (ddlCodRet != null) { ddlCodRet.DataSource = LCodRet.ListarCodRet(); ddlCodRet.DataTextField = "Id"; ddlCodRet.DataValueField = "Tasa"; ddlCodRet.DataBind(); } ddlCodRet.SelectedValue = id.ToString(); }
private void BindData() { GridView1.DataSource = (List <Item_Resg>)Session["ItemsRes"]; GridView1.DataBind(); DropDownList ddlIndFact = GridView1.FooterRow.FindControl("ddlIndFact") as DropDownList; ddlIndFact.DataSource = LIndicadorFacturaType.ListarIndicadorFactura(); ddlIndFact.DataValueField = "Id"; ddlIndFact.DataTextField = "Nombre"; ddlIndFact.DataBind(); TextBox txtMonto = GridView1.FooterRow.FindControl("txtMonto") as TextBox; DropDownList ddlCodRet = GridView1.FooterRow.FindControl("ddlCodRet") as DropDownList; ddlCodRet.DataSource = LCodRet.ListarCodRet(); ddlCodRet.DataValueField = "Tasa"; ddlCodRet.DataTextField = "Id"; }