|
Rank: Member Groups: Member
Joined: 6/14/2007 Posts: 9
|
I have 3 linked SQL Server tables (Country|Province|City) that I want to associate as datasource to a treeview; I used an SQLDataSource as datasource to the treeview, but it did not work (I had my SQL statement (tested) correct in the SQLDataSource but did not set Update, Delete and Insert statements). What are the steps needed to succeed to display those 3 fields in the treeview?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi, I believe you can use:
Code: C#
treeView.DataSource = ds.Select(DataSourceSelectArguments.Empty);
treeView.DataBind()
Thanks
|
|
Rank: Member Groups: Member
Joined: 6/14/2007 Posts: 9
|
I tried your solution this way (putting the code you provided in the init event of the my treeview: tvPaysProvinceVille), but it did not work: Here is my code (Note: Me.SqlDSPaysProvVille is my SQLDataSource control)
Protected Sub tvPaysProvVille_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles tvPaysProvVille.Init Me.tvPaysProvVille.DataSource = Me.SqlDSPaysProvVille.Select(DataSourceSelectArguments.Empty) Me.tvPaysProvVille.DataBind() End Sub
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi,
You will want to check the return value of the Select method. Our TreeView takes a DataView object that Select returns. If that DataView has data, it should work. Otherwise it won't. We will not be able to help you troubleshoot other issues rather than the TreeView works with a DataView data source. You can take any of our samples that demonstrate binding to a DataTable, then use the DataTable.DefaultView to get a DataView object to verify if that part works fine.
Thanks
|
|