コード例 #1
0
ファイル: UltimateList.aspx.cs プロジェクト: suizhikuo/KYCMS
 private void BindStyleCategory()
 {
     ddlStyleType.Items.Clear();
     ddlStyleType.Items.Add(new ListItem("选择所属栏目", "0"));
     B_StyleCategory bll = new B_StyleCategory();
     DataTable dt = bll.GetListItemByStyleId();
     foreach (DataRow dr in dt.Rows)
     {
         string colname = dr["Name"].ToString();
         int colid = Convert.ToInt32(dr["StyleCategoryID"].ToString());
         int depth = int.Parse(dr["Depth"].ToString());
         for (int i = 0; i < depth; i++)
         {
             colname = "├┄" + colname;
         }
         ddlStyleType.Items.Add(new ListItem(colname, colid.ToString()));
     }
 }
コード例 #2
0
ファイル: AddStyleType.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void Page_Load(object sender, EventArgs e)
    {
        AdminGroupBll.Power_Judge(10);
        if(!IsPostBack)
        {
            SkipPageUrl = Request.ServerVariables["HTTP_REFERER"].ToString();

            if (Request.QueryString["styleCategoryId"] == null)
            {
                BindStyleCategory();
            }
            else
            {
                int styleCategoryId;
                btnSave.Text = "修改样式";
                btnReset.Visible = false;
                styleCategoryId = int.Parse(Request.QueryString["styleCategoryId"].ToString());
                BindStyleCategory();

                B_StyleCategory bll = new B_StyleCategory();
                M_StyleCategory model = bll.GetUpdateData(styleCategoryId);
                int parentId = model.ParentID;
                for (int i = 0; i < dropType.Items.Count;i++)
                {
                    if (dropType.Items[i].Value.ToString() == parentId.ToString())
                        dropType.Items[i].Selected = true;
                    if (dropType.Items[i].Value.ToString() == Request.QueryString["styleCategoryId"].ToString())
                        dropType.Items[i].Enabled = false;
                }
                DataTable dt = bll.GetListItemByStyleId();
                DataView dv = dt.DefaultView;
                dv.RowFilter = "ParentID=" + Request.QueryString["styleCategoryId"].ToString() + "";
                for (int j = 0; j < dropType.Items.Count; j++)
                {
                    for (int j1 = 0; j1 < dv.Count; j1++)
                    {
                        if (dropType.Items[j].Value == dv[j1]["styleCategoryId"].ToString())
                        {
                            dropType.Items[j].Enabled = false;
                        }
                    }
                }

                txtStyleTypeName.Text = model.Name;
                txtExplain.Text = model.Desc;
            }

        }
    }