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

后端 未结 2 1332
[愿得一人]
[愿得一人] 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

    This is because your Partial views are strongly typed. Remove the @model declaration in your Partials and access the Model properties like this

    @Html.Partial("_LoginAccount")
    

    and then in your partial

    @Html.TextBoxFor(mod => mod.UserLogin.LoginId) @Html.PasswordFor(mod => mod.UserLogin.Password)

提交回复
热议问题