protected void BindCategoryList() { try { CategoryController sysmgr = new CategoryController(); List <Category> info = sysmgr.Categories_List(); info.Sort((x, y) => x.CategoryName.CompareTo(y.CategoryName)); CategoryList.DataSource = info; CategoryList.DataTextField = nameof(Category.CategoryName); CategoryList.DataValueField = nameof(Category.CategoryID); CategoryList.DataBind(); CategoryList.Items.Insert(0, "select..."); } catch (Exception ex) { errormsgs.Add(GetInnerException(ex).ToString()); LoadMessageDisplay(errormsgs, "alert alert-danger"); } }
protected void BindCategoryList() { //this will be a standard lookup for the Category record try { CategoryController sysmgr = new CategoryController(); List<Category> info = null; info = sysmgr.Categories_List(); info.Sort((x, y) => x.CategoryName.CompareTo(y.CategoryName)); CategoryList.DataSource = info; CategoryList.DataTextField = nameof(Category.CategoryName); CategoryList.DataValueField = nameof(Category.CategoryID); CategoryList.DataBind(); CategoryList.Items.Insert(0, "select..."); } catch (Exception ex) { MessageLabel.Text = ex.Message; } }
public void BindCategoryList() { //TODO: code the method to load the CategoryList control try { CategoryController sysmgr = new CategoryController(); List <Category> info = sysmgr.Categories_List(); info.Sort((x, y) => x.CategoryName.CompareTo(y.CategoryName)); CategoryList.DataSource = info; CategoryList.DataTextField = nameof(Category.CategoryName); CategoryList.DataValueField = nameof(Category.CategoryID); CategoryList.DataBind(); CategoryList.Items.Insert(0, "select ..."); } catch (Exception ex) { errormsgs.Add("File Error: " + GetInnerException(ex).Message); LoadMessageDisplay(errormsgs, "alert alert-warning"); } }
protected void BindCategoryList() { //this will be a standard lookup for the Category records try { CategoryController sysmgr = new CategoryController(); List <Category> info = null; info = sysmgr.Categories_List(); info.Sort((x, y) => x.CategoryName.CompareTo(y.CategoryName)); CategoryList.DataSource = info; CategoryList.DataTextField = nameof(Category.CategoryName); CategoryList.DataValueField = nameof(Category.CategoryID); CategoryList.DataBind(); CategoryList.Items.Insert(0, "select..."); } catch (Exception ex) { //using the specialized error handling DataList control errormsgs.Add(GetInnerException(ex).ToString()); LoadMessageDisplay(errormsgs, "alert alert-danger"); } }