Thursday, April 06, 2006

to build dynamic tree view in asp.net 2.0

Dim treeview2 As New TreeView
treeview2.EnableClientScript = True
treeview2.PopulateNodesFromClient = True
Dim i, j As Integer
Dim ds1 As New DataSet
ds1 = objtest05.fnLoadempdetails(strconn)
i = ds1.Tables(0).Rows.Count

Dim root1(i) As TreeNode
Dim child(i) As TreeNode

j = 0
While j < i
root1(j) = New TreeNode
'root1(j).PopulateOnDemand = True
child(j) = New TreeNode
' child(j).PopulateOnDemand = True
Dim s, s1 As String
s = CStr(ds1.Tables(0).Rows(j).Item(0))
s1 = CStr(ds1.Tables(0).Rows(j).Item(1))
root1(j).Text = s
child(j).Text = s1
root1(j).ChildNodes.Add(child(j))
treeview2.Nodes.Add(root1(j))
PlaceHolder1.Controls.Add(treeview2)
j = j + 1
End While

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home