![]() Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Private Function GetChildByValue(ByVal ID1 As String, ByVal NodeCollection1 As TreeNodeCollection) As TreeNodeįor Each TreeNode1 As TreeNode In NodeCollection1ĭim TreeNode2 As TreeNode = GetChildByValue(ID1, TreeNode1.ChildNodes) (New TreeNode(Name1, ID1))ĭim Node1 As TreeNode = GetChildByValue(Parent1, TreeView1.Nodes) Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.ClickĬode for ASP.NET application Private Sub CreateTree() Private Function FindLevel(ByVal ID As String, ByRef Level As Integer) As Integerĭim Parent1 As String = DataTable1.Rows(i).Item("PARENT").ToStringĬode for VB.NET WindowsForms application Private Sub CreateTree()ĭim MaxLevel1 As Integer = CInt(DataTable1.Compute("MAX(LEVEL)", ""))ĭim Rows1() As DataRow = DataTable1.Select("LEVEL = " & i)ĭim ID1 As String = Rows1(j).Item("ID").ToStringĭim Name1 As String = Rows1(j).Item("NAME").ToStringĭim Parent1 As String = Rows1(j).Item("PARENT").ToStringĭim TreeNodes1() As TreeNode = (Parent1, True) You can change the appearance of all nodes within ASPxTreeView or customize each node in each state either directly via properties or by assigning a CSS class.To fill the TreeView from a DataTable, try the following code Dim DataTable1 As New DataTableĭ("ID", GetType(Integer))ĭ("NAME", GetType(String))ĭ("PARENT", GetType(Integer))ĭ("LEVEL", GetType(Integer))ĭim ID1 As String = DataTable1.Rows(i).Item("ID").ToStringĭataTable1.Rows(i).Item("LEVEL") = FindLevel(ID1, 0).Tooltips can be assigned to individual nodes. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |