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

Setting HtmlAttributes to children loaded on-demand

8 Answers 115 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tx3
Top achievements
Rank 1
Tx3 asked on 11 Nov 2010, 07:59 AM

Hello again!

I have a problem setting style to the tree view items that are loaded on-demand. This is mainly because TreeViewItem's HtmlAttributes is read-only and therefore I can't set it. I did not find any way to set it on the View either:

1..DataBinding(dataBinding => dataBinding.Ajax()
2.    .Enabled(true)
3.    .Select("GetModuleVersions", Constants.ctrl_Module))

-Tatu

8 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 15 Nov 2010, 04:31 PM
Hello Tatu,

Indeed, the HtmlAttributes are not available -- we will try to provide a mechanism to allow styling of the nodes that are dynamically loaded, and will post a follow up with a solution in this thread by the end of the week.

All the best,
Alex Gyoshev
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
Tx3
Top achievements
Rank 1
answered on 16 Nov 2010, 09:06 AM
Thanks for the reply! I have a temporary solution using jQuery plugin called 'livequery' and using jQuery css methods, so this isn't high-priority feature (for me atleast).

-Tatu
0
Accepted
Alex Gyoshev
Telerik team
answered on 19 Nov 2010, 01:48 PM
Hello Tatu,

After inspection of the TreeView code, it turned out that providing such a feature will have effect upon all navigational controls (due to inheritance from the NavigationItem<T>). We will consider a better way of introducing this feature, but at the time being, using a work-around would be smarter.

That said, you can hold on to livequery (if it works in your scenario) or bind a handler to the DataBound event that applies the necessary styles to the items.

All the best,
Alex Gyoshev
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
Tx3
Top achievements
Rank 1
answered on 22 Nov 2010, 01:22 PM
Binding handler to the DataBound event sounds good. I think I'll change to that one. Thanks for the reply.

-Tatu
0
Donna Stewart
Top achievements
Rank 1
answered on 19 Jan 2011, 11:33 PM
Can you please post example code of how you would do this using the onDataBound event?  I believe others have this question as in the thread titled "How do you format TreeView ajax data?".

Thank you so much!
0
Alex Gyoshev
Telerik team
answered on 20 Jan 2011, 10:54 AM
Hi Donna,

The attached solution demonstrates a work-around, in this case - using the Text field to transfer additional data.

Regards,
Alex Gyoshev
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
Simon
Top achievements
Rank 1
answered on 28 Apr 2011, 04:24 PM
Hi,

I'm struggling with this work around as the Text field is reformatted so the Bound function never finds the required spans and the text property simply renders them as text. I'm assuming I'm missing a setting or something? using Razor, which I'm assuming doesn't make any difference?

Thanks
0
Tx3
Top achievements
Rank 1
answered on 28 Apr 2011, 04:49 PM
Hi Simon!

Do you have TreeViewItem encoded set to False?

-Tatu
Tags
TreeView
Asked by
Tx3
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Tx3
Top achievements
Rank 1
Donna Stewart
Top achievements
Rank 1
Simon
Top achievements
Rank 1
Share this question
or