看起来其他人有这个问题,但我似乎无法找到解决方案.
我有2个型号:Person&BillingInfo:
public class Person
{
public string Name { get; set;}
public BillingInfo BillingInfo { get; set; }
}
public class BillingInfo
{
public string BillingName { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用DefaultModelBinder将此直接绑定到我的Action中.
public ActionResult DoStuff(Person model)
{
// do stuff
}
Run Code Online (Sandbox Code Playgroud)
但是,在设置Person.Name属性时,BillingInfo始终为null.
我的帖子看起来像这样:
"NAME = statichippo&BillingInfo.BillingName = statichippo"
为什么BillingInfo总是为空?