示例#1
0
        protected void gr_dato_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                EstadoTipoOperacion mestado = new EstadoTipoOperacion();
                mestado.Codigo_estado = 0;
                mestado.Descripcion   = "Seleccionar";

                List <EstadoTipoOperacion> lestado = new EstadotipooperacionBC().getEstadoByFamilia(id_fam);

                lestado.Add(mestado);


                DropDownList dl2 = (DropDownList)e.Row.FindControl("dl_estado");

                dl2.DataSource     = lestado;
                dl2.DataValueField = "codigo_estado";
                dl2.DataTextField  = "descripcion";
                dl2.DataBind();
                //dl2.SelectedValue = "0";



                GastosComunes gastos = new GastosComunes();
                gastos.Id_tipogasto = 0;
                gastos.Descripcion  = "seleccionar";
                List <GastosComunes> lgastos = new GastosComunesBC().getallGastosComunes(id_fam);
                lgastos.Add(gastos);
                DropDownList dl = (DropDownList)e.Row.FindControl("dl_gasto");

                dl.DataSource     = lgastos;
                dl.DataValueField = "id_tipogasto";
                dl.DataTextField  = "descripcion";
                dl.DataBind();

                //dl.SelectedValue = "0";
                FuncionGlobal.comboEstadoByFamilia(estado_dl, id_fam);
                FuncionGlobal.Combogasto(gasto_dl, id_fam);

                dl.SelectedValue  = gr_dato.DataKeys[e.Row.RowIndex].Values[1].ToString();
                dl2.SelectedValue = gr_dato.DataKeys[e.Row.RowIndex].Values[0].ToString();
            }
        }