protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PageNo = Convert.ToInt32(Request.QueryString["PageNo"]); PageNo = Math.Max(PageNo, 1); var json = _serviceClient.GetDrugStoreCount(); if (json.JObjCodeTrue()) { TotalCount = json.JobjMessageConvert <int>(); if (TotalCount > 0) { json = _serviceClient.GetDrugStore(PageNo, PageSize); if (json.JObjCodeTrue()) { Repeater1.DataSource = from item in json.JObjMessageToken() select new { Name = item["Name"].ValueOrDefault <string>(), Range = item["Range"].ValueOrDefault <string>(), Address = item["Address"].ValueOrDefault <string>(), Id = item["Id"], Type = item["Type"].ValueOrDefault <string>(), }; } } } } TotalPage = TotalCount / PageSize + (TotalCount % PageSize == 0 ? 0 : 1); Page1 = (Math.Max(PageNo, 1) - 1) / PageListNumber * PageListNumber + 1; Repeater1.DataBind(); Page.ClientScript.RegisterStartupScript(GetType(), "pageNoSelector", "<script language='javascript'>pageNoSelector(" + PageNo + "," + TotalPage + ");</script>"); }