private void LlenarDropDownList()
        {
            MaterialDropDownList.DataSource     = material.Listado(" * ", " 1=1 ", " ");
            MaterialDropDownList.DataTextField  = "Descripcion";
            MaterialDropDownList.DataValueField = "IdMaterial";
            MaterialDropDownList.DataBind();

            PrecioDropDownList.DataSource     = material.Listado(" * ", " 1=1 ", " ");
            PrecioDropDownList.DataTextField  = "Precio";
            PrecioDropDownList.DataValueField = "IdMaterial";
            PrecioDropDownList.DataBind();
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Materiales m  = new Materiales();
            DataTable  dt = new DataTable();

            ca.Total += ca.Total;
            if (!IsPostBack)
            {
                MaterialDropDownList.DataSource     = m.Listado("*", "1=1", "");
                MaterialDropDownList.DataTextField  = "Descripcion";
                MaterialDropDownList.DataValueField = "IdMaterial";
                MaterialDropDownList.DataBind();

                dt.Columns.AddRange(new DataColumn[3] {
                    new DataColumn("Material"), new DataColumn("Cantidad"), new DataColumn("Precio")
                });
                ViewState["Detalle"] = dt;
                ViewState["Total"]   = ca.Total;//Tal vez halla una mejor forma de hacerlo pero cree esta session o viewstate que es lo mismo, para poder ir guardando el total sin que me sufra ningun cambio cuando la pag haga load...
            }//habia borrado absolutamente como se hacia esto, mi confuncion fue mas al nunca haberlo intentado antes con textbox unicamente, siempre lo habia practicado con Dropdawnlist
        }