protected void PopulateCompanyDropDownList() { List <Company> companies = aStockInManager.GetAllCompanies(); companyDropDownList.DataSource = companies; companyDropDownList.DataTextField = "Name"; companyDropDownList.DataValueField = "Id"; companyDropDownList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["ID"] != null) { if (!IsPostBack) { companyDropdownList.DataSource = stockInManager.GetAllCompanies(); companyDropdownList.DataTextField = "CompanyName"; companyDropdownList.DataValueField = "Id"; companyDropdownList.DataBind(); companyDropdownList.Items.Insert(0, new ListItem("-Select a company-", "0")); itemDropdownList.Items.Insert(0, new ListItem("-Select a item-", "0")); itemDropdownList.Enabled = false; } } else { Response.Redirect("IndexUI.aspx"); } }