WebGrid 分页和排序不起作用

WebGrid paging and sorting not working

我正在使用 WebGrid 来显示我的信息。我的一个页面的问题是分页和排序不起作用。它适用于所有其他页面,但在一个页面上没有任何反应。

Here is the code for the controller 

public IndiceController(IMapperFacade mapperFacade, IDonneeReferenceService<Indice> indiceService, ILogWriters logWriters)
        {
            this.indiceReference = indiceService;
            MapperFacade = mapperFacade;
        }

        public ViewResult Index(bool afficherSupprime = false)
        {
            var models = this.ApplyInitialSort(indiceReference.GetAll(!afficherSupprime));

            var viewModels = MapperFacade.GetViewModelList<Indice, IndiceViewModel>(models);
            var viewModel = new ListeViewModel<IndiceViewModel>(afficherSupprime, viewModels);
            this.ViewBag.RowsPerPage = 3;
            return View("Index", viewModel);
        }

Here is the view

@using CDP.CMG.WebUI.ViewModels.Shared
@model ListeViewModel<IndiceViewModel>
@{
    Layout = "~/Views/Shared/_ListeLayout.cshtml";
    ViewBag.Title = Layouts.Indice_Index_Title;
    ViewBag.HeaderTitle = Layouts.Indice_Index_Title;

    var grid = new WebGrid(rowsPerPage: ViewBag.RowsPerPage);
    grid.Bind(Model.ViewModels, autoSortAndPage: true, rowCount: Model.ViewModels.Count());
}

@grid.GetHtml("table table-striped table-hover",mode: WebGridPagerModes.All)


Any ideas where i'am missing something ?
Thank for the help.

我在分页和排序方面遇到的问题来自 WebGrid 周围使用的部分 class。 出于某种原因,我无法解释分页和排序不起作用。通过删除部分 class 一切都恢复正常。

所以我的解决方案是删除代码中用于显示 WebGrid

的部分 class