Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PageNo = Convert.ToInt32(Request.QueryString["PageNo"]);
                PageNo = Math.Max(PageNo, 1);
                var json = _serviceClient.GetBikeLocationCount();

                if (json.JObjCodeTrue())
                {
                    TotalCount = json.JobjMessageConvert <int>();
                    if (TotalCount > 0)
                    {
                        json = _serviceClient.GetBikeLocation(PageNo, PageSize);
                        if (json.JObjCodeTrue())
                        {
                            Repeater1.DataSource = from item in json.JObjMessageToken()
                                                   select new
                            {
                                Name = item["Name"].ValueOrDefault <string>(),

                                Address = item["Address"].ValueOrDefault <string>(),
                            };
                        }
                    }
                }
            }
            TotalPage = TotalCount / PageSize + (TotalCount % PageSize == 0 ? 0 : 1);
            Page1     = (Math.Max(PageNo, 1) - 1) / PageListNumber * PageListNumber + 1;
            Repeater1.DataBind();

            Page.ClientScript.RegisterStartupScript(this.GetType(), "pageNoSelector",
                                                    "<script language='javascript'>pageNoSelector(" + PageNo + "," + TotalPage + ");</script>");
        }