【问题标题】:Kendo Grid MVC Sample - Remote Data BindingKendo Grid MVC 示例 - 远程数据绑定
【发布时间】:2016-06-24 17:02:47
【问题描述】:

我是使用 Kendo UI Grid 的新手。我正在查看 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,并且在控制器中没有模型通过 View 方法传递。那么网格是如何填充数据的呢?

【问题讨论】:

  • 它正在使用 Ajax (~/Grid/Orders_Read)

标签: javascript asp.net-mvc user-interface kendo-ui grid


【解决方案1】:

正如fruitbat 所说,Kendo 使用ajax 来填充网格。这都是在网格数据源中配置的。以下是一些值得查看的文档。

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

【讨论】:

    猜你喜欢
    • 2014-12-11
    • 2023-03-16
    • 2015-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-16
    相关资源
    最近更新 更多