I\'m using ASP MVC RC1.
A form I\'m using contains a dropdownlist which I have put in a view with this code.
<%= Html.DropDownList(\"areaid\", (Se
I wanted to use the same SelectList for multiple drop downs and didn't want to duplicate the SelectList in the model so I just added a new Html Extension method that took in a value and set the selected item.
public static MvcHtmlString DropDownList(this HtmlHelper htmlHelper, string name, string value, IList selectList, object htmlAttributes)
{
IEnumerable items = selectList.Select(s => new SelectListItem {Text = s.Text, Value = s.Value, Selected = s.Value == value});
return htmlHelper.DropDownList(name, items, null /* optionLabel */, htmlAttributes);
}