/// <summary> /// 绑定 /// </summary> private void Repeater1bind() { DataTable dt = BLL.publicBLL.GetDt("goods_category", -1, "", "sort asc,goods_category_id desc"); DataTable list = new BLL.publicBLL().MakeTree_Dt(dt, "parentid", "0", "goods_category_id", "goods_category_name", -1); Repeater1.DataSource = list; Repeater1.DataBind(); }
/// <summary> /// 数据绑定 /// </summary> private void Repeater1bind() { setPermission(); // 权限 //List<ProductTypeInfo> list = BLL.ProductTypeBLL.GetList(-1, "", ""); DataTable dt = BLL.Seller_categoryBLL.GetDt(-1, ""); DataTable list = new BLL.publicBLL().MakeTree_Dt(dt, "parentid", "0", "id", "name", -1); Repeater1.DataSource = list; Repeater1.DataBind(); }
protected void bindlist() { System.Text.StringBuilder text = new System.Text.StringBuilder(); string where = ""; DataTable dt = BLL.publicBLL.GetDt("District", -1, where, "Sort asc,DistId desc"); DataTable newdt = new BLL.publicBLL().MakeTree_Dt(dt, "parentid", "0", "DistId", "Name", -1); if (newdt != null && newdt.Rows.Count > 0) { foreach (DataRow dr in newdt.Rows) { int id = Common.Utils.ObjectToint(dr["DistId"]); int sort = Common.Utils.ObjectToint(dr["Sort"]); string name = Common.Utils.ObjectToStr(dr["Name"]); int parentid = Common.Utils.ObjectToint(dr["parentid"]); int cityid = Common.Utils.ObjectToint(dr["cityid"]); int areaid = Common.Utils.ObjectToint(dr["areaid"]); int districtid = Common.Utils.ObjectToint(dr["DistrictId"]); string addstr = ""; if (parentid <= 0)//是省份 { addstr = "添加城市"; } else { if (areaid <= 0)//如果当前行是城市 { addstr = "添加(区、县)"; } else { addstr = "添加商区"; } } text.Append("<div style=\"height:26px;line-height:26px;margin-bottom:2px;\" onmouseover=\"this.style.background='#f2f2f2'\" onmouseout=\"this.style.background='#ffffff'\">"); text.Append("<div style=\"float:left;text-align:left;height:26px;line-height:26px;margin-right:20px;\">"); text.Append("<div style=\"float:left;width:40px;\">" + sort + "</div><div style=\"float:left;\"> " + name + "</div><div style=\"clear:both;\"></div>"); text.Append("</div>"); text.Append("<div style=\"width:200px;float:left;text-align:left;height:26px;line-height:26px;\">"); text.Append("<a href=\"edit_district.aspx?id=" + id + "\">修改</a>"); text.Append(" | <a href=\"javascript:void();\" onclick=\"del(" + id + ");\">删除</a>"); if (districtid <= 0) { text.Append(" | <a href=\"edit_district.aspx?parentid=" + id + "\">" + addstr + "</a>"); } text.Append("</div>"); text.Append("<div style=\"clear:both;\">"); text.Append("</div>"); text.Append("</div>"); } } listHTML = text.ToString(); }