【发布时间】:2017-03-24 13:27:00
【问题描述】:
我有两个类如下
Model:-
public class RegisterViewModel
{
public string Email { get; set; }
public AddressPropertyVM AddressProperty { get; set; }
}
public class AddressPropertyVM
{
public string StreetNo { get; set; }
}
Main Form
@model Application.Models.RegisterViewModel
{
@Html.TextBoxFor(m => m.Email)
@Html.TextBoxFor(m => m.FirstName)
@Html.Partial("_AddressPropertyPartial",Model.AddressProperty)
<button type="submit">Register</button>
}
Partial View Form
@model Application.Models.AddressPropertyVM
{
@Html.TextBoxFor(m => m.StreetNo)
}
我正在创建 asp.net mvc 应用程序。
我已经为 AddressPropertyVM 创建了一个局部视图。
但我们当时发布了表单(主表单),AddressProperty 的数据为空。
【问题讨论】:
-
你能显示视图吗?
-
我的看法是这样的
标签: asp.net-mvc-4 partial-views asp.net-mvc-partialview