【发布时间】:2015-03-06 16:48:04
【问题描述】:
我有一个 slickgrid,正在尝试将其数据保存回服务器。
当我在服务器上断点时,我可以看到 Request.Form 对象中的数据,但我无法让它与我的对象一起工作。
我的数据看起来像...
[
{"id":"0","LineNumber":"","Detail":"MOT cost","Code":" ","Qty":"1","Est":" ","CustomerDamage":false,"Cost":"44.00","Value":"44.00","VAT":true,"SelfBillingLine":"False","DefectStatus":" "},
{"id":"62","LineNumber":"","Detail":"CRACKS IN Chassis","Code":"TLMA02","Qty":"1","Est":"","CustomerDamage":false,"Cost":"35.00","Value":"35.00","VAT":true,"SelfBillingLine":"False","DefectStatus":"Large repair"},
{"id":"63","LineNumber":"","Detail":"TEAR IN N/S CURTAIN","Code":"TLMA02","Qty":"1","Est":"","CustomerDamage":true,"Cost":"10.00","Value":"10.00","VAT":true,"SelfBillingLine":"False","DefectStatus":"Customer"}
]
我正在使用点击按钮发布...
$("#SBSave").click(function() {
debugger;
var details = JSON.stringify(defectrows);
save('SBDetail/SaveSBItem', details);
});
我已经尝试了很多方法来接收数据,但它们都不起作用。
我的控制器...
[HttpPost]
public void SaveSBItem(SelfBillDetailList details, string Approve = "")
{
// Actions here.
}
我的模型... 尝试了很多东西,都不管用......
public class SelfBillDetailList
{
public IEnumerable<SelfBillingIncomingDetail> IncomingDetails { get; set; }
}
public class SelfBillingIncomingDetail
{
public int id { get; set; }
public string Code { get; set; }
public string LineNumber { get; set; }
public string Detail { get; set; }
public string Action { get; set; }
public string Qty { get; set; }
public string Est { get; set; }
public bool VAT { get; set; }
public bool CustomerDamage { get; set; }
public string Cost { get; set; }
public string Value { get; set; }
public DateTime Received { get; set; }
public string DefectStatus { get; set; }
public bool SelfBillingLine { get; set; }
}
所以,我尝试了一个单独的 SelfBillingIncomingDetail 和一个 SelfBillDetailList。
都不行。
我什至发送了一个单独的行,同样,都没有工作。
我想将它作为一个组发送,所以它将是一个 SelfBillingIncomingDetail 数组,但没有任何作用。
感谢您的帮助。
【问题讨论】:
标签: ajax model-view-controller slickgrid