将Kendo Grid dataSource绑定到viewModel模板

时间:2016-10-28 09:16:41

标签: c# asp.net telerik

我在kendo grid内使用scheduler templateCustomerScheduleViewModel包含List<CustomerScheduleParticipantsViewModel>我希望在网格中绑定。

@model slViewModel.CustomerScheduleViewModel
...
    @(Html.Kendo().Grid<CustomerScheduleParticipantsViewModel>() // Specify the type of the grid
        .Name("Grid")
        .BindTo(Model.MyList)
        .Columns(columns =>
        {
            columns.Bound(p => p.CustomerId);
            columns.Bound(p => p.FirstName);

        })
    )

...

但网格仍然是空的; dataSource不包含任何元素。 以下是Kendo UI插件显示的内容:

options: Object{15} 
data: null
schema: Object{4} 
offlineStorage: null
serverSorting: true
serverPaging: true
serverFiltering: true
serverGrouping: true
serverAggregates: true
batch: false
type: "aspnetmvc-server"
transport: Object{2} 
read: Object{1} 
url: ""
prefix: "Grid-"
filter: Array[0] 
table: null
fields: Array[2] 
0: Object{5} 
encoded: true
title: "Customer Id"
headerAttributes: Object{3} 
field: "CustomerId"
filterable: Object{2} 
1: Object{5} 
select: null

data: Array[0] 

更新 代码段已更新:复制粘贴失败 我将其绑定到Model.MyList

类型的<CustomerScheduleParticipantsViewModel>

0 个答案:

没有答案
相关问题