예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] != null)
     {
         id = KillSqlIn.Form_ReplaceByString(Request.QueryString["id"], 10);
     }
     if (!IsPostBack)
     {
         if (this.id != "")
         {
             MenuTypeModel mod = bll.GetModel(this.id);
             if (mod != null)
             {
                 //this.ddlType.SelectedValue = mod.CategoryToTypeId;
                 //this.ddlPCategory.SelectedValue = mod.PCategoryId;
                 this.cSelect.categoryID  = mod.PCategoryId;
                 this.txtMenuName.Text    = mod.CategoryName;
                 this.txtSort.Text        = mod.Orderby.ToString();
                 this.cbIsVisible.Checked = (mod.CategoryFlag == "index") ? true : false;
                 if (mod.Url != null)
                 {
                     imgUrl = "<img src='" + mod.Url + "' width='100' height='100' />";
                 }
                 ViewState["Old_PId"] = mod.PCategoryId;
             }
         }
         else
         {
             //this.ddlPCategory.SelectedValue = this.pCatatoryId;
             //this.cSelect.categoryID = this.pCatatoryId;
         }
     }
 }
예제 #2
0
        /// <summary>
        /// 初始化菜单树
        /// </summary>
        private void Init_TreeViewMenu()
        {
            treeView_Menus.Nodes.Clear();

            List <MenuType> lsMenuType = _menuTypeBll.GetModel();

            TreeNode node = null;

            for (int i = 0; i < lsMenuType.Count; i++)
            {
                node = new TreeNode();
                node.Expand();
                node.Text = lsMenuType[i].MenuTypeName;
                node.Tag  = lsMenuType[i];

                treeView_Menus.Nodes.Add(node);

                GetChildNodes(node, lsMenuType[i].MenuTypeID, 0);
            }

            //展开节点
            treeView_Menus.ExpandAll();

            //设置选中首个节点
        }