• MVC分页技术


    这个是用的插件分页技术

    前台引用和js

        <script type="text/javascript" src="/js/jquery-1.10.2.min.js"></script>
        <script type="text/javascript" src="/js/kkpager.min.js"></script>
        <link rel="stylesheet" type="text/css" href="/css/kkpager_orange.css" />
      
    <script type="text/javascript">
    function getParameter(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) return unescape(r[2]); return null;
            }
    
            $(function () {
    var pageCount = $('#pageCount').val();//获取总页码 var totalRecords = $('#totalRecords').val();//获取总条数 var pageNo = getParameter('pno'); if (!pageNo) { pageNo = 1; } //生成分页 //有些参数是可选的,比如lang,若不传有默认值 kkpager.generPageHtml({ //当前页码 pno: pageNo, //总页码 total: pageCount, //总数据条数 totalRecords: totalRecords, //链接前部 hrefFormer: '/ProductQuality/ExpertProduct', //链接尾部 hrefLatter: '', getLink: function (n) { return this.hrefFormer+this.hrefLatter+'?id='+@(Convert.ToInt32(INDID))+'&pno=' + n; } }); });
    </script>




    //Html代码
     <div style="800px;margin:0 auto;">
                        <div id="kkpager"></div>
                    </div>

    mvc中

            public ActionResult ExpertProduct(string id,string pno)
            {
                int pageIndex;
                int pageSize=2;
    
                if (!int.TryParse(pno,out pageIndex))
                {
                    pageIndex = 1;
                }
                id = id == null ? "0101" : id;//获取专家
                Dictionary<string, object> param = new Dictionary<string, object>();
                param.Add("ID", id);
                string inspectionUser = RouteManager.GetApiRoute("ProductQuality", "GetInspectionExpert", param); ;
                IList<InspectionUsers> model = JsonConvert.DeserializeObject<List<InspectionUsers>>(Catalogs.GetCatalogs(inspectionUser));this.ViewBag.pageCount = Math.Ceiling((double)model.Count/pageSize);//获取总页码
    this.ViewBag.totalRecords = model.Count;//总条数
    return View(model.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList()); }

    http://files.cnblogs.com/files/xbblogs/uploadify.zip

  • 相关阅读:
    mvn 配置修改
    进制换算
    AT指令(中文详解版)二 [转载]
    Linux内核数据包处理流程-数据包接收(3)[转载]
    Linux内核数据包处理流程-数据包接收(2)[转载]
    Linux内核数据包处理流程-数据包接收(1)[转载]
    linux 内核模块 dumpstack
    linux c 用户态调试追踪函数调用堆栈以及定位段错误[转载]
    预处理命令详解(转载)
    [记录]博客开通
  • 原文地址:https://www.cnblogs.com/xbblogs/p/4808950.html
Copyright © 2020-2023  润新知