private void LoadCategory() { BSCategory bs = new BSCategory(); List<Category> datalist = new List<Category>(); Category cat = new Category(); cat.CategoryId = 0; cat.CategoryName = "Select category"; datalist.Add(cat); foreach (Category c in bs.GetCategoryList(0)) { datalist.Add(c); } cmbCategory.DisplayMember = "CategoryName"; cmbCategory.ValueMember = "CategoryId"; cmbCategory.DataSource = datalist; cmbCategory.SelectedIndex = 0; }
private void LoadCategory() { BSCategory bscat = new BSCategory(); List<Category> catList = new List<Category>(); //catList = bscat.GetCategoryList(); catList = bscat.GetCategoryList(0); cmbCategory.DisplayMember = "CategoryName"; cmbCategory.ValueMember = "CategoryId"; cmbCategory.DataSource = catList; }