private void TreeBind(int _channel_id) { BLL.cityinfo bll = new BLL.cityinfo(); DataTable dt = bll.GetList(0, _channel_id); this.ddlParentId.Items.Clear(); this.ddlParentId.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.ddlParentId.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlParentId.Items.Add(new ListItem(Title, Id)); } } }
//数据绑定 private void RptBind() { BLL.cityinfo bll = new BLL.cityinfo(); DataTable dt = bll.GetList(0, 0); this.rptList.DataSource = dt; this.rptList.DataBind(); }