I tried simple dropdownlist in ASP.NET MVC2 but got error below from tryupdatemodel.
How to fix this, everthing looks correct ?
view:
<%= Html.DropDownList("Post24DeliveryPlaces", Model.DeliveryPlace)%>
model:
public IEnumerable<SelectListItem> Post24DeliveryPlaces { get; set; }
public string DeliveryPlace { get; set; }
result:
System.InvalidOperationException: The parameter conversion from type 'System.String' to type 'System.Web.Mvc.SelectListItem' failed because no type converter can convert between these types.
at System.Web.Mvc.ValueProviderResult.ConvertSimpleType(CultureInfo culture, Object value, Type destinationType)
at System.Web.Mvc.ValueProviderResult.UnwrapPossibleArrayType(CultureInfo culture, Object value, Type destinationType)
at System.Web.Mvc.ValueProviderResult.ConvertTo(Type type, CultureInfo culture) at System.Web.Mvc.DefaultModelBinder.ConvertProviderResult(ModelStateDictionary modelState, String modelStateKey, ValueProviderResult valueProviderResult, Type destinationType
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…