Esempio n. 1
0
 //private void tvMenu_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
 //{
 //    if (e.Node != null)
 //    {
 //        e.Node.ImageUrl = @"..\images\icons\Open.gif";
 //    }
 //}
 //private void tvMenu_TreeNodeCollapsed(object sender, TreeNodeEventArgs e)
 //{
 //    if (e.Node != null)
 //    {
 //        e.Node.ImageUrl = @"..\images\icons\TreeViewClose.gif";
 //    }
 //}
 private void BindTree()
 {
     FunctionController controller = new FunctionController();
     DataSet dstMenu = controller.GetAllFunctions();
     if (dstMenu == null || dstMenu.Tables[0].Rows.Count <= 0)
     {
         TreeNode node = new TreeNode();
         node.Text = "系统功能";
         node.Value = "";
         node.NavigateUrl = "";
         this.tvMenu.Nodes.Add(node);
     }
     else
     {
         DataRow[] drs = dstMenu.Tables[0].Select("functionparentid='0'");
         if (drs.Length > 0)
         {
             foreach (DataRow dr in drs)
             {
                 TreeNode node = new TreeNode();
                 node.Text = Convert.ToString(dr["functionname"]);
                 node.Value = Convert.ToString(dr["oid"]);
                 node.NavigateUrl = Convert.ToString(dr["functionurl"]);
                 this.BindChildNode(dstMenu, node);
                 this.tvMenu.Nodes.Add(node);
             }
         }
     }
 }
 private void BindTree()
 {
     this.tvMenu.Nodes.Clear();
     FunctionController controller = new FunctionController();
     DataSet dstMenu = controller.GetAllFunctions();
     TreeNode node = new TreeNode();
     node.Text = "系统功能";
     node.Value = "0";
     node.NavigateUrl = "";
     node.ShowCheckBox = true;
     this.tvMenu.Nodes.Add(node);
     if (dstMenu != null && dstMenu.Tables[0].Rows.Count > 0)
     {
         this.BindChildNode(dstMenu, node);
     }
     this.tvMenu.ExpandAll();
 }