protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { Response.Redirect(cms.Current.GetRootPath); } if (!this.IsPostBack) { CategoryDropdownList.DataValueField = "CategoryRef"; CategoryDropdownList.DataTextField = "CategoryName"; CategoryDropdownList.DataSource = Category.GetCategoryList(); CategoryDropdownList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { searchForLinkText = Utils.GetResourceText("SearchForLinkText"); if (!this.IsPostBack) { CategoryDropdownList.DataSource = Category.GetCategoryList(); CategoryDropdownList.DataTextField = "CategoryName"; CategoryDropdownList.DataValueField = "CategoryRef"; CategoryDropdownList.DataBind(); CategoryDropdownList.Items.Insert(0, new ListItem("Kategori", "0")); } //this.Page.Form.Action = cms.Current.GetRootPath + "Search"; }
public async Task <IQueryable <CategoryDropdownList> > CategoryListDropdown(string name) { var list = _context.Categories.Where(x => x.CategoryName.StartsWith(name)); var List = new List <CategoryDropdownList>(); foreach (Category category in list) { var cate = new CategoryDropdownList() { CategoryId = category.CategoryId, CategoryName = category.CategoryName }; List.Add(cate); } return(List.AsQueryable().OrderBy(x => x.CategoryName)); }
public async Task <IQueryable <CategoryDropdownList> > CateDropList() { var cateList = _context.Categories.ToList(); var List = new List <CategoryDropdownList>(); foreach (Category category in cateList) { var cate = new CategoryDropdownList() { CategoryId = category.CategoryId, CategoryName = category.CategoryName }; List.Add(cate); } return(List.AsQueryable().OrderBy(x => x.CategoryName)); }