Server Error in '/' Application. No parameterless constructor defined for this object

前端 未结 6 1972
感动是毒
感动是毒 2021-01-11 11:55

The callstack shows the following:

[MissingMethodException: No parameterless constructor defined for this object.]
System.RuntimeTypeHandle.CreateInstance(Ru         


        
6条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-11 12:21

    The root of my problem was also SelectList.

    I had this:

    <%: Html.DropDownListFor(m => Model.Destinations, Model.Destinations)%>
    

    When I should have had this:

    <%: Html.DropDownListFor(m => Model.Destination, Model.Destinations)%>
    

    Destination is the user's selection, Destinations is the list of possible values. Using the plural SelectList twice caused the problem.

提交回复
热议问题