MVC 3 Razor Form Post w/ Multiple Strongly Typed Partial Views Not Binding

后端 未结 2 1339
[愿得一人]
[愿得一人] 2021-02-09 06:43

I\'m curious about whether the approach of using multiple strongly typed partials within a form that posts back to the partial containing View is the right MVC approach to doing

2条回答
  •  無奈伤痛
    2021-02-09 07:01

    All partials views should be strongly typed with the same view model (AccountSetup in your case) :

    @model Models.Account.AccountSetup
    
    @Html.TextBoxFor(mod => mod.UserLogin.LoginId)
    @Html.PasswordFor(mod => mod.UserLogin.Password)
    

    Then:

    @Html.Partial("_LoginAccount", Model)
    

提交回复
热议问题