示例#1
0
        private void FillCategoriesCombo()
        {
            cmbCategory.Items.Clear();
            var categories = _productLogic.GetCategories();

            cmbCategory.ValueMember   = "Id";
            cmbCategory.DisplayMember = "Description";

            foreach (var category in categories)
            {
                cmbCategory.Items.Add(category);
            }

            cmbCategory.Items.Add("Nueva Categoria...");
            cmbCategory.Text = "";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            List <UserDetails> listuser = pl.GetAllUser();

            ddlSupplier.Items.Insert(0, new ListItem("Please select Supplier", ""));
            // ddlSupplier.DataTextField=listuser.
            foreach (UserDetails item in listuser)
            {
                ddlSupplier.Items.Add(new ListItem(item.UserName, item.UserId.ToString()));
            }
            List <Category> listcategory = pl.GetCategories();

            ddlCategory.Items.Insert(0, new ListItem("Please select Category", ""));
            foreach (Category item in listcategory)
            {
                ddlCategory.Items.Add(new ListItem(item.CategoryName, item.CategoryId.ToString()));
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         txtName.Text         = Session["ProductName"].ToString();
         id                   = Convert.ToInt32(Session["id"].ToString());
         txtDescription.Value = Session["Description"].ToString();
         txtQuantity.Text     = Session["Quantity"].ToString();
         txtUnitPrice.Text    = Session["Price"].ToString();
         List <UserDetails> listuser = pl.GetAllUser();
         ddlSupplier.Items.Insert(0, new ListItem("Please select Supplier", ""));
         // ddlSupplier.DataTextField=listuser.
         foreach (UserDetails item in listuser)
         {
             ddlSupplier.Items.Add(new ListItem(item.UserName, item.UserId.ToString()));
         }
         List <Category> listcategory = pl.GetCategories();
         ddlCategory.Items.Insert(0, new ListItem("Please select Category", ""));
         foreach (Category item in listcategory)
         {
             ddlCategory.Items.Add(new ListItem(item.CategoryName, item.CategoryId.ToString()));
         }
     }
 }