Beispiel #1
0
        protected void Serachwithcondition_Click(object sender, EventArgs e)
        {
            BLL.LvYouJingDianXinXi mainService = new BLL.LvYouJingDianXinXi();
            string firsttype  = select2.Items[select2.SelectedIndex].Value;
            string secondtype = Request["condition"];//根据name属性获取

            if (secondtype == "")
            {
                int pageIndex = int.Parse(Request["pageIndex"] ?? "1");
                pageindex = pageIndex;
                int pageSize = 5;
                var ds       = mainService.GetListByPage(string.Empty, " ", (pageIndex - 1) * pageSize + 1, pageSize * pageIndex);
                list = mainService.DataTableToList(ds.Tables[0]);
                var allCount = mainService.GetRecordCount(string.Empty);
                DataCount = allCount;
                PageCount = Math.Max((allCount + pageSize - 1) / pageSize, 1);
                Navstring = Common.LaomaPager.ShowPageNavigate(pageSize, pageIndex, allCount);
            }
            else
            {
                int pageIndex = 1;
                pageindex = pageIndex;
                int    allCount   = 0;
                int    pageSize   = 0;
                string combinestr = firsttype + "|" + secondtype;
                pageSize = 1000;
                var ds = mainService.GetListByPage(combinestr, " ", (pageIndex - 1) * pageSize + 1, pageSize * pageIndex);
                list      = mainService.DataTableToList(ds.Tables[0]);
                allCount  = mainService.GetRecordCount(combinestr);
                DataCount = allCount;
                if (DataCount == 0)
                {
                    showinfo = "没有数据!";
                }
                PageCount = 1;
                PreSerach = secondtype;
                Navstring = Common.LaomaPager.ShowPageNavigate(pageSize, pageIndex, allCount);
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int pageIndex = int.Parse(Request["pageIndex"] ?? "1");

            pageindex = pageIndex;
            int pageSize = 5;

            BLL.LvYouJingDianXinXi mainService = new BLL.LvYouJingDianXinXi();
            var ds = mainService.GetListByPage(string.Empty, " ", (pageIndex - 1) * pageSize + 1, pageSize * pageIndex);

            //取当前页的数据
            list = mainService.DataTableToList(ds.Tables[0]);
            //设置一共多少页
            var allCount = mainService.GetRecordCount(string.Empty);

            DataCount = allCount;
            PageCount = Math.Max((allCount + pageSize - 1) / pageSize, 1);
            //生成 分页的标签
            Navstring = Common.LaomaPager.ShowPageNavigate(pageSize, pageIndex, allCount);
        }