剃刀的WebGrid AJAX分页和排序 [英] Razor webgrid ajax paging and sorting

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

问题描述

我想学习如何在MVC3使用剃刀的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:

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

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