i am trying to post a JavaScript object to my MVC controller, however its not binding the nested object.
c# object:
public class OrderHeader
{
public OrderHeader()
{
this.orderAddress = new OrderAddress();
}
public int SubTotal{ get; set; }
public string OrderNumber { get; set; }
public OrderAddress orderAddress;
}
public class OrderAddress
{
public OrderAddress()
{
}
public int id { get; set; }
public int OrderID { get; set; }
public string BillToFName { get; set; }
}
js object:
{ OrderNumber: "KM123", SubTotal: "10", orderAddress: { BillToFName: "street 2" } }
I can read orderNumber and SubTotal perfectly fine within my controler, however BillToFName is NOT binding.
尝试在您的媒体资源中添加一个getter和setter:
public OrderAddress orderAddress { get; set; }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.