• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Asp.netMvcDwz分页

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

下面的代码还是有些问题的,随后再解决吧

 @{
        var pagination = ViewBag.pagination as DwzMvc.DwzPagination;
    }
    <div class="panelBar">
        <div class="pages">
            <span>显示</span>
            <select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
 
                @foreach (var i in new[] { 20, 50, 100, 200 })
                {
                    <option @(i == pagination.NumperPage ? "selected=\"selected\"" : "") value="@i">@i</option>
                }
 
            </select>
            <span>条,共@(pagination.TotalCount)条</span>
        </div>
 
        <div class="pagination" targettype="@pagination.TargetType" totalcount="@pagination.TotalCount" numperpage="@pagination.NumperPage" pagenumshown="@pagination.PagenumShown" currentpage="@pagination.CurrentPage"></div>
 
    </div>
    <form id="pagerForm" method="post" action="@Url.HttpRouteUrl(pagination.RouteName, pagination.RouteValues)">
 
        <input type="hidden" name="pageNum" value="1" />
        <input type="hidden" name="numPerPage" value="@pagination.NumperPage" />
 
        @foreach (var key in pagination.NameValues.AllKeys)
        {
            <input type="hidden" name="@key" value="@pagination.NameValues[key]" />
        }
    </form>

 

 

 
    public class Constant
    {
        public const string navTab = "navTab";
 
    }
 
    /// <summary>
    /// DWZ的分页模型
    /// </summary>
    public class DwzPagination
    {
 
        private int pagenumshown = 10;
        private int totalcount;
        private int numperpage = 20;
        private int currentpage = 1;
 
        private NameValueCollection _nameValues = new NameValueCollection();
        private string _targetType = Constant.navTab;
        private string _routeName;
        private RouteValueDictionary _routeValues;
 
        /// <summary>
        /// 显示多少个页码
        /// </summary>
        public int PagenumShown
        {
            get { return pagenumshown; }
            set { pagenumshown = value; }
        }
        /// <summary>
        /// 总量
        /// </summary>
        public int TotalCount
        {
            get { return totalcount; }
            set { totalcount = value; }
        }
        /// <summary>
        /// 每页多少条
        /// </summary>
        public int NumperPage
        {
            get
            {
                var quest = Dev.Comm.Web.DevRequest.GetInt("numPerPage", 0);
                if (quest > 0)
                {
                    numperpage = quest;
                }
                return numperpage;
            }
            private set
            {
 
                numperpage = value;
            }
        }
        /// <summary>
        /// 当前页码
        /// </summary>
        public int CurrentPage
        {
            get { return currentpage; }
            set { currentpage = value; }
        }
        /// <summary>
        /// 保存相关的值
        /// </summary>
        public NameValueCollection NameValues
        {
            get { return _nameValues; }
            set { _nameValues = value; }
        }
        /// <summary>
        /// 打开类型
        /// </summary>
        public string TargetType
        {
            get { return _targetType; }
            set { _targetType = value; }
        }
 
        public string RouteName
        {
            get { return _routeName; }
            set { _routeName = value; }
        }
 
        public System.Web.Routing.RouteValueDictionary RouteValues
        {
            get { return _routeValues; }
            set { _routeValues = value; }
        }
    }

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Asp.netcore学习笔记(HttpClient)发布时间:2022-07-10
下一篇:
Asp.NetCoreApp部署故障示例1发布时间:2022-07-10
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap