The GetBrands and GetModelTypes methods actually return nothing. They do something like this to make sure nothing is returned!
public static IEnumerable<SelectListItem> GetBrands() { StockManagementDataContext db = new StockManagementDataContext(); var brands = from m in db.Material [b]where m.Description == "ABC"[/b] select new SelectListItem { Text = m.Description, Value = m.MaterialId.ToString(), }; return brands; }
My question: is it possible to initialize ViewData["Brands"] with an empty list or is there another more efficient way to link the model to an empty list by default?
Thx that's working - I don't like to use it but I needed some way to link the selected item from a listbox to the ViewModel - but I'll figure it out :-)
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Open in new window