I know I should set the Node.CssClass, but it doesn't work.
(I am an absolute beginner in ASP.NET.)
Thanks,Martin
Hello,
This is Kunal. I am facing the same problem. I have to bind the data fetched from database to the webdatatree with different colors. I am fetching the colors from database itself along with all the other data. Now my question is how to change the text color of the nodes using their respective colors that have been fetched from database?
I am looking forward for your reply.
Thanks,
Kunal.
Thanks Dave, now it works, that is, I see the right colors.
I only wonder why the colored text is underlined. As a workaround I am no solving this issue by applying
to the style at the same time. But do you know what is going on?
Martin
Hey,
Try adding a period to the front of you css class names.
So: .active and .inactive. The styles inside should work just fine. Also, check that the css is being applied to the node in the html. Let me know if this works.
Dave
Thanks for your reply David.
In the first place I want to change the ForeColor.
I think I should do this using the <style> tag, and I think I can do this in different locations
1) On a local level (on the page itself)
2) On a global stylesheet (CSS file)
Anyway, i have chosen for 1)
Here is the event handler in which I want to set the style of the Node,
protected void WebDataTree1_NodeBound(object sender, Infragistics.Web.UI.NavigationControls.DataTreeNodeEventArgs e) { HubComponentStatus c = (e.Node.DataItem as WebHierarchyData).Item as HubComponentStatus;
if (c != null) { if (c.Available.HasValue) { if (c.Available.Value) { e.Node.CssClass = "active"; } else { e.Node.CssClass = "inactive"; } } } }
And a part of the page.
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="server"> <style> active { color: Green; } inactive { color: Red; } </style> <ig:WebDataTree ID="WebDataTree1" runat="server" DataSourceID="WebHierarchicalDataSource1" Height="300px" Width="100%" onnodebound="WebDataTree1_NodeBound"></ig:WebDataTree>
Hey Martin,
What color are you trying to set? The background color? Text color? You might need some other things in your css depending upon that. Let me know and we should be able to help you out.
regards,
David Young