Hello,
I have this treeview on my html page
<iewc:treeview id="tree1" style="Z-INDEX: 101; LEFT: 48px; POSITION: absolute; TOP: 80px" runat="server"></iewc:treeview></form>
and here's my code behind code. The data values are coming back fne but they are arranged horizontally netx to each other, and there is no hierarchy. Why is this?
Thanks,
Burak
' connect to the database
Dim strCnn, sql, id, name As String
strCnn = ConfigurationSettings.AppSettings("ConnectionString")
Dim cnn As New SqlConnection(strCnn)
Dim dsGroup As New DataSet
Dim daGroup As New SqlDataAdapter("SELECT distinct TableGrp FROM Audit_Tables", cnn)
daGroup.Fill(dsGroup, "Groups")
Dim nodeGroup, nodeTable As TreeNode
Dim rowGroup As DataRow
Dim group As String
For Each rowGroup In dsGroup.Tables("Groups").Rows
group = rowGroup("TableGrp")
nodeGroup = New TreeNode
nodeGroup.ID = group
nodeGroup.Text = group
'nodeGroup.ID = rowSupp("SupplierID")
tree1.Nodes.Add(nodeGroup)
'' open connection
cnn.Open()
' get the audit table names to work with
sql = " select id, TableName from Audit_Tables where TableGrp = '" & group & "'"
' prepare the stored procedure that returns the records fitting the search criteria
Dim cmd As New SqlCommand(sql, cnn)
cmd.CommandType = CommandType.Text
' execute command
Dim reader As SqlDataReader
reader = cmd.ExecuteReader
' open reader
While reader.Read()
id = reader.Item("id")
name = reader.Item("TableName")
nodeTable = New TreeNode
nodeTable.ID = name
nodeTable.Text = name
nodeTable.NavigateUrl = "testpage2.aspx?id=" & id
nodeGroup.Nodes.Add(nodeTable)
End While
' close reader
reader.Close()
' close connection
cnn.Close()
Next
'clean up
dsGroup.Dispose()
daGroup.Dispose()
cnn.Close()
cnn.Dispose()