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);
                string json = _serviceClient.GetChildSchoolCount();

                if (json.JObjCodeTrue())
                {
                    TotalCount = json.JobjMessageConvert <int>();
                    if (TotalCount > 0)
                    {
                        json = _serviceClient.GetChildSchool(PageNo, PageSize);
                        if (json.JObjCodeTrue())
                        {
                            Repeater1.DataSource = from item in json.JObjMessageToken()
                                                   select new
                            {
                                Name     = item["Name"].ValueOrDefault <string>(),
                                HomePage = item["Url"].ValueOrDefault <string>(),
                                Address  = item["Address"].ValueOrDefault <string>(),
                                Tel      = item["Tel"].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>");
        }
Exemplo n.º 2
0
        private void KindergartenBinding()
        {
            string json = _openDataServiceClient.GetChildSchoolCount();

            if (json.JObjCodeTrue() && json.JobjMessageConvert <int>() > 0)
            {
                json = _openDataServiceClient.GetChildSchool(1, 5);
                RepeaterKindergarten.DataSource = from item in json.JObjMessageToken()
                                                  select new
                {
                    Name    = item["Name"].ValueOrDefault <string>(),
                    Address = item["Address"].ValueOrDefault <string>(),
                    //Type = item["Type"].ValueOrDefault<string>(),
                };
                RepeaterKindergarten.DataBind();
            }
        }