This question is locked. New answers and comments are not allowed.
Nikhil Kashyap
Top achievements
Rank 1
Nikhil Kashyap
asked on 31 May 2010, 10:30 AM
Hi,
Wanted to know, can we change the color of certain nodes in the TreeView ? If yes, then how?
Regards
Nikhil Kashyap
Wanted to know, can we change the color of certain nodes in the TreeView ? If yes, then how?
Regards
Nikhil Kashyap
3 Answers, 1 is accepted
0
Hello Nikhil Kashyap,
You can style the nodes as any HTML element - by using CSS. You can assign custom css class for the specific nodes by using the HtmlAttributes method:
nodes.Add().Text("Node").HtmlAttributes(new {@class="test"})
Regards,
Atanas Korchev
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.
You can style the nodes as any HTML element - by using CSS. You can assign custom css class for the specific nodes by using the HtmlAttributes method:
nodes.Add().Text("Node").HtmlAttributes(new {@class="test"})
Regards,
Atanas Korchev
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
Nikhil Kashyap
Top achievements
Rank 1
answered on 08 Jun 2010, 12:43 PM
Hi,
Not able to use the syntax which you have given. Attaching the screenshot of my code where im trying to use this. We are using databinding to load the treeview and depending on some condition we want to change the colors of some nodes. Plz let us know the exact syntax in this case. Thanks
Regards
Nikhil
Customer Id: JT359876
Not able to use the syntax which you have given. Attaching the screenshot of my code where im trying to use this. We are using databinding to load the treeview and depending on some condition we want to change the colors of some nodes. Plz let us know the exact syntax in this case. Thanks
Regards
Nikhil
Customer Id: JT359876
0
Hi Nikhil Kashyap,
In this case you need to add required attribute to the dictionary. Here is a code snippet showing how to achieve this:
Sincerely yours,
Georgi Krustev
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.
In this case you need to add required attribute to the dictionary. Here is a code snippet showing how to achieve this:
mappings.For<Category>(binding => binding .ItemDataBound((item, category) => { item.HtmlAttributes.Add("class", "test"); item.Text = category.CategoryName; }) .Children(category => category.Products));Sincerely yours,
Georgi Krustev
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.