Ajax功能在MVC4 webgrid中不起作用

时间:2014-03-20 10:06:10

标签: jquery ajax asp.net-mvc asp.net-mvc-4

Ajax分页和排序在MVC4 WebGrid中不起作用

这是代码

 @{ WebGrid grid = new WebGrid(rowsPerPage: Model.PageSize, canPage: true, canSort: true, ajaxUpdateContainerId: "Grid");
grid.Bind(Model.List, rowCount: Model.TotalRecordCount, autoSortAndPage: false);    }

<div id="grid">
            @grid.Table(
                tableStyle: "table table-bordered table-hover",

                columns: new[] {
                    grid.Column("Id"),
                     grid.Column("SampleText"),
                    grid.Column("Descreption")    
            })
        </div>


@grid.PagerList(mode: WebGridPagerModes.All) 

我正在使用jquery-2.1.0.min

请给我一些建议。 提前致谢

1 个答案:

答案 0 :(得分:1)

您必须在代码之前包含jquery以生成网格。

<script src="@Url.Content("~/Scripts/jquery-2.1.0.js")"></script> 
相关问题