Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int pageSize = 5;
            int pageIndex;

            if (!int.TryParse(Request.QueryString["pageIndex"], out pageIndex))
            {
                pageIndex = 1;
            }
            BLL.UserInfoService UserInfoService = new BLL.UserInfoService();
            int pagecount = UserInfoService.GetPageCount(pageSize);//获取总页数

            PageCount = pagecount;
            //对当前页码值范围进行判断
            pageIndex = pageIndex < 1 ? 1 : pageIndex;
            pageIndex = pageIndex > pagecount ? pagecount : pageIndex;
            PageIndex = pageIndex;
            List <UserInfo> list = UserInfoService.GetPageList(pageIndex, pageSize);//获取分页数据
            StringBuilder   sb   = new StringBuilder();

            foreach (UserInfo userInfo in list)
            {
                sb.AppendFormat("<li><span>{0}</span><a href='#' target='_blank'>{1}</a></li>", userInfo.RegTime.ToShortDateString(), userInfo.UserName);
            }
            StrHtml = sb.ToString();
        }
Exemple #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int pageIndex;

            if (!int.TryParse(context.Request["pageIndex"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize = 5;

            BLL.UserInfoService UserInfoService = new BLL.UserInfoService();
            int pageCount = UserInfoService.GetPageCount(pageSize);//获取总页数.

            //判断当前页码值的取值范围。
            pageIndex = pageIndex < 1 ? 1 : pageIndex;
            pageIndex = pageIndex > pageCount?pageCount:pageIndex;
            //获取分页数据
            List <UserInfo> list = UserInfoService.GetPageList(pageIndex, pageSize);
            //获取页码条。
            string pageBar = Common.PageBarHelper.GetPagaBar(pageIndex, pageCount);

            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            string str = js.Serialize(new  { UList = list, MyPageBar = pageBar });//将数据序列化成JSON字符串。匿名类。

            context.Response.Write(str);
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int pageSize = 10;
            int pageIndex;

            if (!int.TryParse(Context.Request.QueryString["pageIndex"], out pageIndex))
            {
                pageIndex = 1;
            }
            BLL.UserInfoService userInfoServer = new BLL.UserInfoService();

            //对当前的页码范围进行判断
            int pageCount = userInfoServer.GetPageCount(pageSize);

            pageIndex = pageIndex < 1 ? 1 : pageIndex;
            pageIndex = pageIndex > pageCount ? pageCount : pageIndex;
            PageIndex = pageIndex;
            PageCount = pageCount;

            List <UserInfo> list = userInfoServer.GetList(pageIndex, pageSize);
            StringBuilder   sb   = new StringBuilder();

            foreach (UserInfo item in list)
            {
                sb.AppendFormat("<li><span>{0}</span><a href='' target='_blank'>{1}</a></li>", item.RegTime.ToShortDateString(), item.UserName);
                strHtml = sb.ToString();
            }
        }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            int pageIndex;

            if (!int.TryParse(context.Request["pageIndex"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize = 10;

            BLL.UserInfoService userInfoService = new BLL.UserInfoService();
            int pageCount = userInfoService.GetPageCount(pageSize);

            //判断当前页码值得取值范围
            pageIndex = pageIndex < 1 ? 1 : pageIndex;
            pageIndex = pageIndex > pageCount ? pageCount : pageIndex;
            List <Model.UserInfo> list = userInfoService.GetList(pageIndex, pageSize);
            string pagebar             = Common.PagebarHelper.GetPagebar(pageIndex, pageCount);

            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); //序列化和反序列化的类
            string str = js.Serialize(new { UList = list, MyPageBar = pagebar });                                                 //将数据序列化成json字符串。匿名类

            context.Response.Write(str);
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int pageIndex;

            if (!int.TryParse(Request["pageIndex"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize = 5;

            BLL.UserInfoService userInfoService = new BLL.UserInfoService();
            int pageCount = userInfoService.GetPageCount(pageSize);

            pageIndex = pageIndex < 1 ? 1 : pageIndex;
            pageIndex = pageIndex > pageCount ? pageCount : pageIndex;
            PageIndex = pageIndex;
            PageCount = pageCount;
            this.Repeater1.DataSource = userInfoService.GetList(pageIndex, pageSize);
            this.Repeater1.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int pageIndex;

            if (!int.TryParse(Request["pageIndex"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize = 5;

            BLL.UserInfoService UserInfoService = new BLL.UserInfoService();
            int pageCount = UserInfoService.GetPageCount(pageSize);

            PageCount = pageCount;
            pageIndex = pageIndex < 1 ? 1 : pageIndex;
            pageIndex = pageIndex > pageCount ? pageCount : pageIndex;
            PageIndex = pageIndex;
            this.Repeater1.DataSource = UserInfoService.GetPageList(pageIndex, pageSize);
            this.Repeater1.DataBind();

            // ViewState["aaa"] = "asdafsdf";如果将整个页面的ViewState禁用掉,ViewState不能实现状态保持了。
        }