<%= Html.DropDownList("CityID") %>
ViewData["CityID"] = new SelectList(from c in someDataContext.Cities orderby c.Name select c, "CityID","Name", selectedCityID);
<%= Html.DropDownList("[select a city]", "CityID") %>
$(function() { $("select[@name='CityID'] option[@value='<%= ViewData.Model.CityID%>']").attr('selected', 'selected');});
$(function() {
$("select[@name='CityID'] option[@value='<%= ViewData.Model.CityID%>']").attr('selected', 'selected');
});
Page rendered at Tuesday, February 09, 2010 5:36:06 PM (New Zealand Daylight Time, UTC+13:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.