我在razor视图中有以下kendo Grid
@(Html.Kendo().Grid<PO>()
.Name("manualMatchGrid")
.Columns(columns =>
{
BindFields(columns);
})
.Selectable(s => s.Mode(GridSelectionMode.Multiple))
.Pageable()
.Sortable()
.DataSource(dataSource =>
dataSource.Ajax()
.Batch(true)
.PageSize(20)
.ServerOperation(false)
.Model(model =>
{
model.Id(l => l.Id);
})
.Read(read => read.Action("ReadInvoicePOs", "Invoice", new { invoiceID = ViewBag.InvoiceID }).Data("getInvoicePOsFilterData"))
)
.Pageable()
.Navigatable()
)
和getInvoicePOsFilterData javascript函数......
<script>
function getInvoicePOsFilterData() {
return {
pONumber: $('#PONumber').val(), vendorId: $('#VendorId').val(), clientId: $('#ClientId').val()
};
}
</script>
查看chrome网络检查器......
Data InvoiceId,即routeData,没有发送任何内容。我错过了什么。
编辑:
...控制器
[AcceptVerbs(HttpVerbs.Get)]
public JsonResult ReadInvoicePOs([DataSourceRequest]DataSourceRequest request, int invoiceId, string pONumber, int? vendorId, int clientId)
{
var pOs = dynamicPOManager.GetPOs(invoiceId, clientId, pONumber);
DataSourceResult result = pOs.ToDataSourceResult(request);
return Json(result, JsonRequestBehavior.AllowGet);
}
答案 0 :(得分:0)
我发现了问题。问题是POST是Read方法的默认值。我添加了“Type(HttpVerbs.Get)”,它运行得很好。
.Read(read => read.Action("ReadInvoicePOs", "Invoice", new { invoiceID = ViewBag.InvoiceID }).Data("getInvoicePOsFilterData").Type(HttpVerbs.Get))