【问题标题】:mvc webgrid ajax pagingmvc webgrid ajax 分页
【发布时间】:2012-05-14 11:14:22
【问题描述】:
@{ 
    var gridUser = new WebGrid(canPage: true, defaultSort: "CreatedOn", rowsPerPage: 5, 
                            ajaxUpdateContainerId: "Divxyz"); 
    gridUser.Bind(Model.abc, rowCount: Model.User.Count(), autoSortAndPage: true); 
    gridUser.Pager(WebGridPagerModes.All); 

} 
<div id="Divxyz" style="display: none">

我正在使用带有 ajax 分页的 mvc3 webgrid ...我想出了我的解决方案来执行上述 ajax 分页。

但是.....我的网格位于页面底部,当我单击页码时(它显示 # 作为其链接页面),它会将我带到页面顶部,将网格再次移动到页面底部页码点击。请帮我解决这个问题。

提前致谢 .

【问题讨论】:

    标签: asp.net-mvc-3 webgrid


    【解决方案1】:

    我想出了问题的解决方案。 我在下面添加了脚本,当我点击页码页面时不会滚动

    <script type="text/javascript">
        $(function () {
            $('th a, tfoot a').live('click', function () {
                $(this).attr('href', '#DivGridUser-anchor');
            });
    
        });
    </script>
    

    【讨论】:

      猜你喜欢
      • 2013-10-09
      • 1970-01-01
      • 2012-06-21
      • 2011-05-19
      • 2011-05-10
      • 2012-07-22
      • 2012-02-15
      • 2015-05-18
      相关资源
      最近更新 更多