Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            int id = 0;

            if (!string.IsNullOrEmpty(context.Request.Form["id"]))
            {
                id = int.Parse(context.Request.Form["id"]);
            }


            BLL.AreaBll       cb = new BLL.AreaBll();
            StringBuilder     sb = new StringBuilder();
            List <Model.Area> cm = cb.CityList(id);

            sb.Append("[");
            if (cm.Count > 0)
            {
                for (int i = 0; i < cm.Count; i++)
                {
                    Model.Area model = cm[i];
                    sb.Append("{");
                    sb.AppendFormat(@"""c_name"":""{0}"",", model.title);
                    sb.AppendFormat(@"""c_code"":""{0}""", model.id);
                    sb.Append("}");
                    if (i < cm.Count - 1)
                    {
                        sb.Append(",");
                    }
                }
            }
            sb.Append("]");
            // System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
            System.Web.HttpContext.Current.Response.Write(sb.ToString());
            context.Response.End();
        }
Example #2
0
        private void RptBind(string _strWhere)
        {
            BLL.AreaBll bllArea = new BLL.AreaBll();
            this.txtKeywords.Text = this.keywords;
            this.page             = DTRequest.GetQueryInt("page", 1);
            string strWhere = "";

            strWhere = _strWhere + where;
            this.rptList.DataSource = bllArea.list_page(this.page, this.pageSize, " and " + strWhere, " ");
            this.rptList.DataBind();

            //綁定頁碼
            this.totalCount = bllArea.GetNewsTatalNum(strWhere);
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("Area_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }