public void GetAllProducts() { ProductDropDownList.DataSource = _SalesRepository.GetAllProducts(); ProductDropDownList.DataTextField = "Name"; ProductDropDownList.DataValueField = "Code"; ProductDropDownList.DataBind(); ProductDropDownList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select Products", "0")); }
public DataTable LoadProductCategory() { DataTable dt = null; try { SmvBLL smvBLL = new SmvBLL(); dt = smvBLL.LoadProductCategory(); if (dt.Rows.Count > 0) { ProductDropDownList.DataSource = dt; ProductDropDownList.DataValueField = "ProductId"; ProductDropDownList.DataTextField = "ProductName"; ProductDropDownList.DataBind(); ProductDropDownList.Items.Insert(0, new ListItem("Please Select", "0")); } } catch (Exception ex) { } return(dt); }