Kendo UI Grid不呈现MVC

时间:2014-12-12 11:19:23

标签: asp.net-mvc vb.net kendo-grid

我有

Function Index(rqst As DataSourceRequest) As JsonResult
    Dim result = db.App_Modules.Select(Function(am) New With { _
                                                 .code = am.code, _
                                                 .name = am.name _
                                             } _
                                        )
    Return Json(result.ToDataSourceResult(rqst), JsonRequestBehavior.AllowGet)

End Function

视图是

@(Html.Kendo().Grid(Model) _
.Name("gAppModules") _
.Columns(Sub(c)
                 c.Bound(Function(p) p.code)
                 c.Bound(Function(p) p.name)
                 c.Command(Sub(com)
                                   com.Edit()
                           End Sub)

         End Sub) _
.DataSource(Function(d)
                    d _
                    .Ajax() _
                    .Create("Create", "App_Modules") _
                    .Update("Edit", "App_Modules") _
                    .PageSize(2) _
                    .Batch(True) _
                    .Read("Index", "App_Modules") _
                    .Model(Sub(m)
                                   m.Id(Function(i) i.code)
                           End Sub)
            End Function) _
.Filterable() _
.Pageable() _
.Editable(Sub(e) e.Mode(GridEditMode.InCell)) _
.ToolBar(Sub(t)
                 t.Create()
         End Sub)
)

当我运行上述内容时,我得到的页面只是结果:

{"Data":[{"code":"DTA","name":"Device Testing Application1"},{"code":"ISS","name":"Inventory Scanning System"},{"code":"MES","name":"Management ..."}],"Total":3,"AggregateResults":null,"Errors":null}

当我将控制器更改为

        Async Function IndexOLD(request As DataSourceRequest) As Task(Of ActionResult)
        Return View(Await db.App_Modules.ToListAsync())

    End Function

我正在获得正确的网格渲染,但在这种情况下,我无法在客户端使用可分页,可排序等。

在第一种情况下我缺少什么,并且网格不会呈现结果?任何想法?

谢谢

0 个答案:

没有答案