Kendo网格MVC样本 - 远程数据绑定



我是使用Kendo UI网格的新手。我正在查看MVC样本,无法弄清远程绑定样品如何从控制器传递到视图:

控制器代码:

public partial class GridController : Controller
    {
        public ActionResult Remote_Data_Binding()
        {
            return View();
        }
    }

查看代码:

@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.OrderViewModel>()    
    .Name("grid")
    .Columns(columns => {
        columns.Bound(p => p.OrderID).Filterable(false).Width(100);
        columns.Bound(p => p.Freight).Width(100);
        columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}").Width(140);
        columns.Bound(p => p.ShipName);
        columns.Bound(p => p.ShipCity).Width(150);
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Read(read => read.Action("Orders_Read", "Grid"))
     )
)

在视图代码中没有指定@model,并且在控制器中没有传递模型。然后,网格如何填充数据?

fruitbat表示Kendo使用Ajax填充网格。这些都是在网格数据源中配置的。这是一些值得一看的文档。

http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/grid/configuration#read

最新更新