i am populating a “Category” dropdown list with LINQ. (Northwind databse)
var Category = (from cat in _db.Categories.ToList()
select new SelectListItem
{
Text = cat.CategoryName,
Value = cat.CategoryID.ToString()
}).ToList();
I wish to add an extra value at the beginning of this list to be the filter reset, something like “All” so i expect the dropdown to be something like :
- All //added
- Beverages // from query
- Condiments // from query
1 Answer