@Html.DropDownListFor(m => m.categoryList, new SelectList(Model.categoryList, "Value", "Text")) public IEnumerablecategoryList { get; set; } KochiDealsEntities1 db = new KochiDealsEntities1(); public IEnumerable fetchCategoryList() { var cat = (from m in db.ItemCategories select new { m.CategoryID,m.CategoryName }).AsEnumerable().Select(x => new SelectListItem { Value = x.CategoryID.ToString(), Text = x.CategoryName, Selected = true }); return cat; }
Monday, January 28, 2013
Fill Dropdownlist in mvc
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment