This is a migrated thread and some comments may be shown as answers.

Using SQLDataAdapter to populate Treeview

1 Answer 65 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
swells
Top achievements
Rank 1
swells asked on 17 Aug 2010, 03:09 PM
I have a SQLDataAdapter with a data relation defined thusly:
        Dim cnn As SqlConnection = New SqlConnection(Application("ConnStr"))
        Dim cmd1 As SqlDataAdapter = New SqlDataAdapter("select * from topic_Areas Order by Topic_Name ASC", cnn)
        Dim ds As DataSet = New DataSet()
        cmd1.Fill(ds, "topic_Areas")
        Dim cmd2 As SqlDataAdapter = New SqlDataAdapter("select * from vw_DCMP_Topics_Subjects Order by Subject_Name ASC", cnn)
        cmd2.Fill(ds, "vw_DCMP_Topics_Subjects")
        ds.Relations.Add("myrelation", ds.Tables("topic_Areas").Columns("Topic_Num"), ds.Tables("vw_DCMP_Topics_Subjects").Columns("Topic_Num"))
       'some form of setting the Treeview datasource on this line
        Page.DataBind()
        cnn.Close()

I would like to have the Parent nodes populated with the topic_areas and the child nodes for each parent node filled with the vw_DCMP_Topics_Subjects related data.

Is if possible to do this with the Treeview and if so how would one do this?

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
swells
Top achievements
Rank 1
answered on 17 Aug 2010, 03:43 PM
Sorry, never mind, found this article so I will try this approach.

http://www.telerik.com/help/aspnet-ajax/tree_databindingtoloadingrelatedtables.html
Tags
TreeView
Asked by
swells
Top achievements
Rank 1
Answers by
swells
Top achievements
Rank 1
Share this question
or