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

images dynamically set from Datatable setting?

2 Answers 94 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Jonathan Hylton
Top achievements
Rank 1
Jonathan Hylton asked on 01 Apr 2010, 11:10 AM
Hi there,

When using the tree view I would like to set a node image depending on what I have specified in the datatabe. for intance I am doing the following:

1. I load a datset datatable from an SQL database
the columns in the Datatable are
ID, ParentID, Name, SQL_Query, Type


list is listed as follows with the binding:

FillSqlDs(

"TreeView_Reports", "Select * from SYSM_T_REPORT_TREE_VIEW ORDER BY NAME")

 

 

Me.TV_Reports.DataSource = ds.Tables("TreeView_Reports")

 

 

Me.TV_Reports.ValueMember = "ID"

 

 

Me.TV_Reports.ParentIDMember = "ParentID"

 

 

Me.TV_Reports.DisplayMember = "Name"

 

 

Me.TV_Reports.DataMember = "SQL_Query"

 



I would like to be able to set the image depending on the "Type". for instance I have 2 options here type = Folder or Type = Report. I want the node that corelates to "Folder" to display a folder image that i have in my images list (ImageID 0) and if Type = Report, then the node image should show that of a report Image (ImageID 1). 

I also plan to have if I double click the folder, it will expand the node as it currently is, however if I double click the Report node it will spawn off a DataGridView in another form that I have loading into the RadDock MDI Container.

any help you could offer would be greatly appreciated.

Many thanks!

Jonathan

2 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 07 Apr 2010, 10:30 AM
Hi Jonathan Hylton,

In regards to your first requrement, you need to traverse all RadTreeView nodes recursively and set the appropriate image depending on the data contained in the DataBoundItem.

As to your second inquiry, you need to handle the NodeExpandedChanging event and cancel it depending the DataBoundItem data.

I am attaching a sample project which demonstrates the approaches. If you have additional questions, feel free to contact me.

Sincerely yours,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Stefan
Telerik team
answered on 18 Mar 2011, 08:30 AM
Hello Jonathan,

Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out.
For more information about this release, please refer to this blog post.

All the best,
Stefan
the Telerik team
Tags
Treeview
Asked by
Jonathan Hylton
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Stefan
Telerik team
Share this question
or