private void BindStyleCategory() { dllLbCategory.Items.Clear(); dllLbCategory.Items.Add(new ListItem("请选择类别", "0")); B_LbCategory bll = new B_LbCategory(); DataTable dt = bll.GetListItemByLabelId(); foreach (DataRow dr in dt.Rows) { string colname = dr["Name"].ToString(); int colid = Convert.ToInt32(dr["LbCategoryID"].ToString()); int depth = int.Parse(dr["Depth"].ToString()); for (int i = 0; i < depth; i++) { colname = "├┄" + colname; } dllLbCategory.Items.Add(new ListItem(colname, colid.ToString())); } }
protected void Page_Load(object sender, EventArgs e) { AdminGroupBll.Power_Judge(6); if(!IsPostBack) { SkipPageUrl = Request.ServerVariables["HTTP_REFERER"].ToString(); if (Request.QueryString["lbCategoryId"] == null) { BindStyleCategory(); } else { BindStyleCategory(); btnSave.Text = "修改类别"; btnReset.Visible = false; B_LbCategory bll = new B_LbCategory(); if (Request.QueryString["lbCategoryId"].ToString() == "1") { dropLabelType.Enabled = false; } for (int i = 0; i < dropLabelType.Items.Count;i++ ) { if(dropLabelType.Items[i].Value==Request.QueryString["parentId"].ToString()) { dropLabelType.Items[i].Selected = true; } if (dropLabelType.Items[i].Value == Request.QueryString["lbCategoryId"].ToString()) { dropLabelType.Items[i].Enabled = false; } DataTable dt = bll.GetListItemByLabelId(); DataView dv = dt.DefaultView; dv.RowFilter = "ParentID=" + Request.QueryString["lbCategoryId"].ToString() + ""; for (int j = 0; j < dropLabelType.Items.Count; j++) { for (int j1 = 0; j1 < dv.Count; j1++) { if (dropLabelType.Items[j].Value == dv[j1]["lbCategoryId"].ToString()) { dropLabelType.Items[j].Enabled = false; } } } } M_LbCategory model = bll.GetLabeCategoryIdData(int.Parse(Request.QueryString["lbCategoryId"].ToString())); txtLabelTypeName.Text = model.Name; txtExplain.Text = model.Desc; } } }