I'm using a treeview for navigation in asp.net 2, but I don't want to use the sitemap navigation structure of the sql navigation that's out there... I just want to populate my treeview like the good ol days.
Now, I can get it to populate parent nodes... but how do I get it to populate the child nodes? as some of my child nodes will have more child nodes... This is the code that I'm currently using (Not working), and attached is a picture of my table structure...
VB Code:
Private Sub FillTreeView()
Try
TreeView1.Nodes.Clear()
Dim Cons As New PtechDLL.DBFunctions
Dim DBCon As String = Cons.DBConnectionstring
Dim TreeCon As New SqlConnection(DBCon)
Dim FillTreeSQL As String = "SELECT NodeID, Title, Description, URL, Parent, UserTypeID FROM tNavigation ORDER BY ItemNumber"
Dim FillTree As New SqlCommand(FillTreeSQL, TreeCon)
TreeCon.Open()
Dim FillTreeRead As SqlDataReader = FillTree.ExecuteReader
Response.Write("There has been an error: " & vbCrLf & "This occurred in MainInterface Class Sub BindlstOnWaterRails" & vbCrLf & ex.Message & vbCrLf & "If the problem continues contact your IT department or the software vendor")
End Try
End Sub
In Windows forms, I can use the tag property of each node to store what the parentnode id is, and then search through it and thus add the child nodes, but treeview in asp.net doesn't have this feature... How can I structure the child nodes in this solution?
Thanks alot all. Please see the image attached for my table structure...