我有一个购买表格来根据模型接收一些数据,但这里我在控制器中的 purchase_return 对象没有接收任何数据。它正在接收 productId 0 和 productNm null。谁能指出这里发生了什么?的HTML:
<form id="Purchase_ReturnForm">
<div>
<table>
<tr>
<td>
@Html.LabelFor(model => model.ProductId)
</td>
<td>
@Html.TextBoxFor(model => model.ProductId)
</td>
<td>
<input type="button" id="btnFind" value="Find" />
</td>
</tr>
<tr>
<td>
@Html.LabelFor(model => model.ProductNm)
</td>
<td>
<span id="edit">
@Html.TextBoxFor(model => model.ProductNm)
</span>
</td>
</tr>
</table>
</div>
</form>
剧本:
<script>
$(document).ready(function () {
$('#btnFind').click(function () {
var data = $('Purchase_ReturnForm').serialize();
$.ajax({
type: 'Post',
url: '/Purchase_Return/FindProductInvoice',
data: data,
success: function () {
}
})
});
});
</script>
在控制器中:
public ActionResult FindProductInvoice(Purchase_Return purchase_Return)
{
return View();
}
和模型
public class Purchase_Return
{
//public DateTime ReturnDt { get; set; }
//public int ReturnSl { get; set; }
//public DateTime PurchaseDt { get; set; }
//public int PurchaseSl { get; set; }
//public double TotReturnAmt { get; set; }
//public double TotVat { get; set; }
//public double TotDiscount { get; set; }
//public int CustomerSupplyId { get; set; }
[Display(Name="Product")]
public int ProductId { get; set; }
public string ProductNm { get; set; }
//public double PurchaseRt { get; set; }
//public double PurchaseQty { get; set; }
//public double ProductDisAmt { get; set; }
//public double ProductVat { get; set; }
//public string ReturnNote { get; set; }
//public int InsertUserId { get; set; }
}