private void TreeBind(int _channel_id) { BLL.CategoryBll bll = new BLL.CategoryBll(); DataTable dt = bll.GetList(_channel_id); this.ddlParentId1.Items.Clear(); this.ddlParentId1.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.ddlParentId1.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlParentId1.Items.Add(new ListItem(Title, Id)); } } }
//数据绑定 private void RptBind() { BLL.CategoryBll bll = new BLL.CategoryBll(); DataTable dt = bll.GetList(this.channel_id); this.rptList.DataSource = dt; this.rptList.DataBind(); }
private void TreeBind(int _channel_id) { BLL.CategoryBll bll = new BLL.CategoryBll(); DataTable dt = bll.GetList(channel_id); this.ddlCategoryId.Items.Clear(); this.ddlCategoryId.Items.Add(new ListItem("所有类别", "")); foreach (DataRow dr in dt.Rows) { string Id = dr["ID"].ToString(); string Title = dr["Title"].ToString().Trim(); this.ddlCategoryId.Items.Add(new ListItem(Title, Id)); } }