ViewModel with SelectList binding in ASP.NET MVC2

前端 未结 3 1309
北恋
北恋 2021-01-05 01:29

I am trying to implement an Edit ViewModel for my Linq2SQL entity called Product. It has a foreign key linked to a list of brands.

Currently I am populating the bra

3条回答
  •  一生所求
    2021-01-05 02:08

    A new attribute DropDownList for your property BrandId may be helpful. Have a look at the Extending ASP.NET MVC 2 Templates article. But this approach uses ViewData as selectlist's items source.

提交回复
热议问题