Not sure if this is new to mv4 or if it exists in prior version. But the DropDownListFor includes an additional parameter for the SelectList Constructor.
SelectList(IEnumerable, String, String, Object)
For example:
Html.DropDownListFor( x => x.Countries[ i ], New SelectList(Model.CountryList,"ID","Description",Model.Countries[i]))
Where ID
is the Country ID in the CountryList
object and Description
is the Country Name.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…