0
我用下面的代碼來NULL:與參數劍道電網讀取數據,對於某些原因
@(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)
{...}
我沒有說爲什麼會發生真實的任何想法...文檔告訴我,都必須是確定。
是的,正確的,修正了最新的更新 –