+ Infinite hierarchy tree

Usually see the database dynamically generated class menu, there are two ways to generate below:

  1. Generated using TreeView + xml
  2. Using ul and li, the use of recursive logic; designed with CSS + JavaScript

Recently learned of this class menu wording on the use of relatively simple, the following instructions to start practice


Preface:

The first article published program finally came out.

Usually see the database dynamically generated class menu, there are two ways to generate below:

  1. Generated using TreeView + xml
  2. use
      versus
    • , The use of recursive logic; designed with CSS + JavaScript
      1. 91 can refer to a large MenuMatic + [ASP.NET] Recursive long menu
      2. Meow large ASP.NET 2.0 TreeView dynamically generated using data tables of the tree structure

Recently learned of this class menu wording on the use of relatively simple, the following instructions to start the practice.

Front Introduction and preparation:

A, dTree official website: http://www.destroydrop.com/javascripts/tree/

  1. It is an infinite tree menu can be recorded on state
  2. The same screen you can create multiple menu tree
  3. Support browsers: IE 5 +, Netscape 6 +, Opera 7 +, Mozilla (ease of use)

Second, the basic wording:

 
 

Third, the complete wording:

specification:

a.add(编号, 父编号,'文字','网址','提示文字','目标','一般图示','点选图示','开启状态');

example:

a.add(1, 0, '关于我', 'me.aspx', '自我介绍', 'main', 'folder.gif', 'open_folder.gif',true);

Fourth, the attribute setting:

a.config.target = "mytarget"; → open the default destination
a.config.folderLinks = true; whether → directory can be linked
a.config.useSelection = true; → whether to render the current high brightness option
a.config.useCookies = true; → ON state if the current record
a.config.useLines = true; → whether to draw a line between nodes
a.config.useIcons = true; → whether to present the illustrated
a.config.useStatusText = false; → replaced with the node name URL displayed in the status bar
a.config.closeSameLevel = false; → whether or not to close the same layer as the node clicked
a.config.inOrder = false; → if the parent node is always placed on the child node, this setting may be set true to speed up.

The tree structure of the database:

The following is an endless menu structure design of database fields;

1.sn numbered, 2. ofsn parent ID, 3. title as the title, 4. url string is connected to

Front ASP.NET Introduction and preparation:

web.config


  
  
        
   
   

  
   
  

.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" Debug="true" %>





    树状目录
    
 
 " type="text/css" rel="stylesheet" />
    


    
 
 

.vb

Imports System.Data
Imports System.Text

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            '调用 dtree,建立树状菜单
            dtree()
        End If
    End Sub

    Private Function dtree() As String
        'StringBuilder类 表示一个和字符串相似的对象,它的值是一个可变动的连续符值,
        '之所以可变动的原因是一旦以附加、移除、取代或插入符的方式建立后就可以修改。

        Dim sb As New StringBuilder
        Using connect As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
            connect.Open()
            'sn为编号,ofsn为父编号
            Using Adp_Links As New OleDb.OleDbDataAdapter("SELECT * FROM links ORDER BY ofsn , sn", connect)
                Dim mydataset As New DataSet
                Adp_Links.Fill(mydataset, "links")
                If mydataset.Tables("links").Rows.Count > 0 Then

                    '
                    'mydataset有值后,开始附加数据给sb
                    '
                    sb.Append("")

                    '将sb的字符串指定给 LiteMenu
                    Me.LiteMenu.Text = sb.ToString
                End If
            End Using
        End Using
        '回传 LiteMenu 的数据
        Return (Me.LiteMenu.Text)
    End Function
End Class

Screen Results Figure:

Now the HTML source code:

Conclusion Description:

Sample Code:Dtree_ASP.NET_for_VB.rar

These are the little brother of the demonstration, the wording, the inadequacies of the concept, please forgive me, but also trouble we hesitate to give advice.

After the experience of self-published article (Miscellaneous):

Send a record of the article, the pressure is really great, always wanted afraid misconceived, poorly written (Sound mystery: do not do can never be sure their own problems).

This is just the first piece of recording technology articles, give yourself encouragement and motivation to keep going.

Original: Big Box  tree + infinity class


Guess you like

Origin www.cnblogs.com/petewell/p/11495878.html