Welcome Guest Search | Active Topics | Sign In | Register

SQLDataSource to treeview binding (2007.1) Options
Webideal
Posted: Friday, July 25, 2008 5:59:11 PM
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?
eo_support
Posted: Friday, July 25, 2008 6:14:57 PM
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
Webideal
Posted: Wednesday, July 30, 2008 6:53:12 AM
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
eo_support
Posted: Wednesday, July 30, 2008 7:50:41 AM
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



You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.