what is the best way to use Html.DropDownListFor when you have a list of objects ?

Posted by oo on Stack Overflow See other posts from Stack Overflow or by oo
Published on 2010-03-21T11:22:49Z Indexed on 2010/03/21 11:31 UTC
Read the original article Hit count: 311

In my view model if have a:

  List<Car>

where car has an Id and a name. I want to create a dropdown box using

Html.DropDownListFor()

what is the best way to hook this up as i want to have the value of the item be the Id and the display to be the Name of the Car.

© Stack Overflow or respective owner

Related posts about html.dropdownlistfor

Related posts about asp.net-mvc-2