我正在使用以下代码:
@(Html.Kendo().Grid(Model.Orders)
.Name("gridOrders")
.Columns(columns =>
{
columns.Bound(p => p.Date).Title("Date");
columns.Bound(p => p.Reference).Title("Reference");
columns.Bound(p => p.Products).Title("Product(s)");
columns.Bound(p => p.Customer).Title("Customer");
columns.Bound(p => p.ServiceName).Title("Service");
columns.Bound(p => p.OrderTotal).Title("Order total");
})
.Pageable()
.Sortable()
.Scrollable(scr => scr.Height(400))
.Filterable()
.Editable(editable => editable.Mode(GridEditMode.InLine))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.ID))
.Model(model => model.Field(x => x.Reference).Editable(false))
.Model(model => model.Field(x => x.OrderTotal).Editable(false))
.Model(model => model.Field(x => x.Date).Editable(false))
.Model(model => model.Field(x => x.ServiceName).Editable(false))
.Model(model => model.Field(x => x.Products).Editable(false))
.Model(model => model.Field(x => x.Customer).Editable(false))
.PageSize(10)
.ServerOperation(true)
//.Read(read => read.Action("GetOrders", "Dashboard", new { datex = "lalala" } ))
.Read(read => read.Action("GetOrders", "Dashboard").Type(HttpVerbs.Post).Data("getValues"))
))
如您所见,使用了getValues JavaScript函数。我在这个功能中有什么:
<script>
function getValues() {
return {
datex: "2012/12/12" // $("#dates").data("kendoDropDownList").value()
};
}
</script>
在控制器代码中,我将datex参数设为NULL:
[HttpPost]
public JsonResult GetOrders([DataSourceRequest]DataSourceRequest request, string datex)
{...}
我没有任何想法为什么会发生这种情况...... Docs告诉我一切都必须好。
答案 0 :(得分:0)