你看看
http://www.chinabs.net
里面有关于这样的资料,可以的

解决方案 »

  1.   

    不习惯C#,以下是我的代码
    Public Sub InitNav()
            If SelfAo Is Nothing Then
                SelfAo = Session("SelfAo")
            End If
            If SelfAo.LoginStatus = False Then
                Exit Sub
            End If
            Dim Cls As New CSQLGet()
            Cls.StrCnn = SelfAo.DBInfo
            Dim Rs As ADODB.Recordset
            Rs = Cls.GetRs("Select * From BaseAoMenu Order by MID")
            Cls = Nothing
            Dim I As Long
            Dim Node As Microsoft.Web.UI.WebControls.TreeNode
            Dim Dict As Scripting.Dictionary
            Dict = New Scripting.Dictionary()
            Dict.CompareMode = Scripting.CompareMethod.TextCompare
            With BaseTree
                .Nodes.Clear()
                For I = 1 To Rs.RecordCount
                    Dim StrRela As String, StrSelf As String
                    StrRela = vbNullString
                    StrSelf = CNulls(Rs("MID").Value, vbNullString)
                    If InStr(StrSelf, ".", CompareMethod.Text) <> 0 Then
                        StrRela = Left(Rs("MID").Value, InStrRev(Rs("MID").Value, ".") - 1)
                    End If
                    If StrRela = vbNullString Then
                        Node = New Microsoft.Web.UI.WebControls.TreeNode()
                        If CNulls(Rs("MMenuItemID").Value, vbNullString) <> vbNullString Then
                            Node.ID = CNulls(Rs("MMenuItemID").Value, vbNullString)
                        End If
                        Node.Expanded = True
                        Dim FilePath As String
                        FilePath = Server.MapPath("../images/Menu/")
                        If CNulls(Rs("MMenuItemID").Value, vbNullString) <> vbNullString Then
                            If File.Exists(FilePath & Rs("MMenuItemID").Value & ".gif") Then
                                Node.ImageUrl = "../images/Menu/" & Rs("MMenuItemID").Value & ".gif"
                            Else
                                Node.ImageUrl = "../images/Menu/MenuBack.gif"
                            End If
                        Else
                            Node.ImageUrl = "../images/Menu/MenuBack.gif"
                        End If
                        .Nodes.Add(Node)
                        Dict(StrSelf) = Node.GetNodeIndex
                    Else
                    Node = New Microsoft.Web.UI.WebControls.TreeNode()
                    If CNulls(Rs("MMenuItemID").Value, vbNullString) <> vbNullString Then
                        Node.ID = CNulls(Rs("MMenuItemID").Value, vbNullString)
                    End If
                    'Node.Expanded = True
                    Node.Text = CNulls(Rs("MLabel").Value, vbNullString)
                    Dim NodeParent As Microsoft.Web.UI.WebControls.TreeNode
                    NodeParent = BaseTree.GetNodeFromIndex(Dict(StrRela))
                    Node.ImageUrl = "../images/Menu/Next.gif"
                    Node.DefaultStyle.AppendCssText("font-family: 宋体, Arial;" & _
                                "font-size: 12px;" & _
                                "color: white;")
                    NodeParent.Nodes.Add(Node)
                    Dict(StrSelf) = Node.GetNodeIndex
                    NodeParent = Nothing
                    End If
                    Node = Nothing
                    Rs.MoveNext()
                Next
            End With
            Dict = Nothing
            Rs.Close() : Rs = Nothing
        End Sub
      

  2.   

    客户端没有任何代码,把控件画上就可以了,控件ID我的程序是BaseTree