private void TreeBindArea() { BLL.area_category bll = new BLL.area_category(); DataTable dt = bll.GetList(0); this.ddlAreaId.Items.Clear(); this.ddlAreaId.Items.Add(new ListItem("请选择地区...", "0")); foreach (DataRow dr in dt.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); if (ClassLayer == 1) { this.ddlAreaId.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlAreaId.Items.Add(new ListItem(Title, Id)); } } }
//数据绑定 private void RptBind() { BLL.area_category bll = new BLL.area_category(); DataTable dt = bll.GetList(0); this.rptList.DataSource = dt; this.rptList.DataBind(); }