This question is locked. New answers and comments are not allowed.
subItems.push( { Text: "Some text" Value: "Some value", HtmlAttributes: ... class: someClass ... });How does one set the css class for a particular node when a treeview is loaded via Ajax?
Thanks,
5 Answers, 1 is accepted
0
Hello Claudiu,
For more information you can examine our online demo for the TreeView component. Kind regards,
Hristo Germanov
the Telerik team
Thank you for contacting us.
Could you try this code snippet:
<%= Html.Telerik().TreeView() .Name("TreeView") .Items(item => { item.Add() ... .HtmlAttributes(new { @class="test" }) .Items(subItem => { subItem.Add() ... .HtmlAttributes(new { @class="test1" }); }); }) %>For more information you can examine our online demo for the TreeView component. Kind regards,
Hristo Germanov
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
cp
Top achievements
Rank 1
answered on 02 Jun 2011, 02:47 PM
But how would I do it when using client side binding?
http://demos.telerik.com/aspnet-mvc/razor/treeview/clientsidebinding
Thanks,
http://demos.telerik.com/aspnet-mvc/razor/treeview/clientsidebinding
Thanks,
0
Hi Claudiu,
You can use the OnDataBound client event:
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-treeview-client-api-and-events.html#OnDataBound
It is raised when all new items have been populated, so in order to find the desired node, you should use some DOM operations (e.g. find a node by its content or hierarchy position in the DOM tree).
Best wishes,
Dimo
the Telerik team
You can use the OnDataBound client event:
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-treeview-client-api-and-events.html#OnDataBound
It is raised when all new items have been populated, so in order to find the desired node, you should use some DOM operations (e.g. find a node by its content or hierarchy position in the DOM tree).
Best wishes,
Dimo
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
cp
Top achievements
Rank 1
answered on 08 Jun 2011, 09:33 PM
I'm not trying to find nodes, as I stated in my first post I'd like to set a css class on specific nodes at bind time.
Thanks,
Thanks,
0
Hi Claudiu,
Since there is no event fired when each node is databound, you have to use the OnDataBound event, which is fired after all nodes have been populated. And at that time you will have to determine by some criteria which specific nodes need the custom CSS class.
All the best,
Dimo
the Telerik team
Since there is no event fired when each node is databound, you have to use the OnDataBound event, which is fired after all nodes have been populated. And at that time you will have to determine by some criteria which specific nodes need the custom CSS class.
All the best,
Dimo
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
