ASP.Net MVC - model with collection not populating on postback

后端 未结 6 480
面向向阳花
面向向阳花 2020-12-01 19:08

I have an ASP.Net MVC application with a model which is several layers deep containing a collection.

I believe that the view to create the objects is all set up co

6条回答
  •  星月不相逢
    2020-12-01 19:52

    The first argument of Html.TextBox is the name of the textbox, the second would be the value.

    "Wrong":

    <%= Html.TextBox("person.PersonDetails.ContactInformation[0].Data")%>
    

    "Right":

    <%= Html.TextBox("nameoftextbox", person.PersonDetails.ContactInformation[0].Data)%>
    

提交回复
热议问题