Razor webgrid ajax 分页和排序 [英] Razor webgrid ajax paging and sorting

查看:23
本文介绍了Razor webgrid ajax 分页和排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习如何在 MVC3 中使用 Razor WebGrid.ajaxUpdateCallback 参数如何工作?

I'm trying to learn how to use Razor WebGrid in MVC3. How does the ajaxUpdateCallback parameter work?

推荐答案

ajaxUpdateCallback 是在服务器调用完成后将被调用的 javascript 函数的名称.你的问题的标题是关于使用 WebGrid 进行分页和排序的,它看起来像这样......

The ajaxUpdateCallback is the name of the javascript function that will get called after the server call is complete. The title of your question is regarding paging and sorting with the WebGrid which would look something like this...

@{
    var grid = new WebGrid(canPage: true, rowsPerPage: ThisController.PageSize, canSort: true, ajaxUpdateContainerId: "grid");
    grid.Bind(Model.Employees, rowCount: Model.TotalRecords, autoSortAndPage: false);
    grid.Pager(WebGridPagerModes.All);
    @grid.GetHtml(htmlAttributes: new { id="grid" },
        columns: grid.Columns(
            grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { EmployeeID = item.EmployeeID })),
            grid.Column("FullName"),
            grid.Column("Title")
        ));
}

如果你想看的话,我这里有一个完整的例子:

I have a full example here if you'd like to see it:

示例

这篇关于Razor webgrid ajax 分页和排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆