zoukankan      html  css  js  c++  java
  • TreeView的简单应用

    html代码
    AutoGenerateDataBindings="False" CssClass="tb_tree" ShowLines="True" ExpandDepth="0">

    cs代码

        private void BindData()
        {       
            DataView dvAll = OperationStartMenu.GetDataView();      
            dvAll.Sort = "NodeSort";
           
            this.TreeView.Nodes.Clear();

            TreeNode root = new TreeNode();

            root.Text = "启动业务";
            root.Value = "BusinessStart";
            root.ImageUrl = "~/images/ftb/folder.small.gif";

            if (!Page.IsPostBack)
            {
                root.Select();
            }

            this.TreeView.Nodes.Add(root);

            this.InitTree(root, dvAll);

            this.TreeView.ExpandDepth = 1;
        }

        protected void InitTree(TreeNode Node, DataView dvAll)
        {
            dvAll.RowFilter = string.Format("FatherNodeValue='{0}'", Node.Value);

            for (int i = 0; i < dvAll.Count; i++)
            {
                DataRowView drv = dvAll[i];

                string NodeText = drv["NodeText"].ToString();
                string NodeValue = drv["NodeValue"].ToString();
                string NodeSort = drv["NodeSort"].ToString();
                string NodeUrl = drv["NodeUrl"].ToString();

                TreeNode ChildNode = new TreeNode();

                ChildNode.NavigateUrl = NodeUrl;
                ChildNode.Text = NodeText;
                ChildNode.Value = NodeValue;
                if (ChildNode.NavigateUrl.Length == 0)
                {
                    ChildNode.ImageUrl = "~/images/ftb/folder.small.gif";
                }
                else
                {
                    ChildNode.NavigateUrl = string.Empty;
                    ChildNode.ImageUrl = "~/images/ftb/office2003/createlink.gif";
                }

                Node.ChildNodes.Add(ChildNode);

                InitTree(ChildNode, dvAll);

                dvAll.RowFilter = string.Format("FatherNodeValue='{0}'", Node.Value);
            }
        }

    数据表

    名称

    类型

    可否空

    默认值

    说明

    ID

    Numeric

    N

     

    自增主键

    FatherNodeValue

    Varchar2(500)

    N

    父节点标识

    NodeValue

    Varchar2(500)

    N

    节点标识

    NodeMenuID

    Varchar2(20)

    Y

    节点对应的业务菜单ID(若不为空,则根据此项查找对应的URL

    NodeUrl

    Varchar2(200)

    Y

    节点URL

    NodeText

    Varchar2(200)

    N

    节点显示名称

    UserID

    Varchar2(20)

    N

    用户ID

    NodeSort

    Numeric

    N

    节点顺序

    NodeUrlTarget

    Varchar2(20)

    N

    是否为系统内地址

    IsLeafNode

    Varchar2(20)

    N

    是否为叶节点

    欢迎拍砖,欢迎转载,欢迎关注,欢迎联系,就是各种欢迎
  • 相关阅读:
    【iCore3 双核心板】例程九:ADC实验——电源监控
    【iCore3 双核心板】例程八:定时器PWM实验——呼吸灯
    【iCore3双核心板】扩展引脚分布
    【iCore3 双核心板】例程七:WWDG看门狗实验——复位ARM
    【iCore3 双核心板】例程六:IWDG看门狗实验——复位ARM
    【iCore3 双核心板】例程五:SYSTICK定时器实验——定时点亮LED
    【iCore3 双核心板】例程四:USART通信实验——通过命令控制LED
    【iCore3 双核心板】例程三:EXTI中断输入实验——读取ARM按键状态
    【iCore3 双核心板】例程二:读取arm按键状态
    【iCore3 双核心板】例程一:ARM驱动三色LED
  • 原文地址:https://www.cnblogs.com/EddyPeng/p/1225871.html
Copyright © 2011-2022 走看看