protected void Page_Load(object sender, EventArgs e) { sortstr = base.GetStringValue("order", "hit"); TypeId = base.GetIntValue("typeid"); aid = base.GetIntValue("aid"); sid = base.GetIntValue("sid"); did = base.GetIntValue("did"); if (!IsPostBack) { PageInit(); } if (aid == 0 && sid == 0 && did == 0) { AreaName = string.Empty; } else { AreaName = abll.GetAreaName(aid) + " " + abll.GetAreaName(sid) + " " + abll.GetAreaName(did); //address_list.SelectedIndex = defaultIndex; } }
private void PageInit() { AreaName = abll.GetAreaName(did); //加载店铺类别 rpt_shoptypelist.DataSource = new ShopTypeBLL().GetList(); rpt_shoptypelist.DataBind(); //加载街道 List <Area> list = new List <Area>(); if (aid == 0) { list = new AreaBLL().GetListByidlist("1,2,3,4"); } else { list = new AreaBLL().GetListByidlist(aid.ToString()); } rpt_streets.DataSource = list; rpt_streets.DataBind(); List <Area> list2 = new List <Area>(); #region ===========加载小区============ //加载小区 if (sid > 0) { list2 = abll.GetListByidlist(sid.ToString()); } else { List <Area> alllist = new List <Area>(); if (Cache["allarea"] != null) { alllist = HttpContext.Current.Cache["allarea"] as List <Area>; } else { string prestr = ""; foreach (Area item in list) { prestr += item.Id + ","; } prestr.Remove(prestr.Length - 1, 1); alllist = abll.GetListByidlist(prestr); HttpContext.Current.Cache.Insert("allarea", alllist); } int i = 0; foreach (Area ar in alllist) { if (i > 24) { break; } list2.Add(ar); i++; } } //list2 = abll.GetListByidlist(prestr); rpt_district.DataSource = list2; rpt_district.DataBind(); #endregion hiddenaid.Value = aid.ToString(); hiddensid.Value = sid.ToString(); //加载店铺 shopinit(); }