title: Styling asp.net treeview per node
body: <p>I'm attempting to style a treeview where the parent node and child nodes text are displayed in different colors.</p>
  
  <p>The problem is the nodes are links and are styled using CSS.</p>
  
  <pre><code>a, a:link, a:visited, a:active {
  color: #823551;
  </code></pre>
  
  <p>} </p>
  
  <p>That colors the child nodes the way I want but my question is how do I override the style attributes for the parent node? </p>
  
  <p>Alternatively how do I apply CssClass attributes to just the Treeview control without defining the style for the entire page?</p>
  
  <pre><code>&lt;Asp:Treeview CssClass="TreeView" ID="TreeView1" runat="server" ShowExpandCollapse ="false"&gt;
  &lt;ParentNodeStyle CssClass="parentNode" /&gt;
  &lt;LeafNodeStyle CssClass="leafNode"/&gt;  
  &lt;/Asp:Treeview&gt;
  </code></pre>
  
  <p>I've also tried setting the ForeColor property in the ParentNodeStyle but it does not work.</p>
  
  <p>Any ideas?</p>
  
  <p>Update:
  Generated HTML, apologies for the verbosity, its all wrapped up in DNN:</p>
  
  <p>Rootnode:</p>
  
  <pre><code>&lt;a class="dnn_ctr424_View_TreeView1_0 rootNode dnn_ctr424_View_TreeView1_1" href="javascript:__doPostBack('dnn$ctr424$View$TreeView1','s2015')" onclick="TreeView_SelectNode(dnn_ctr424_View_TreeView1_Data, this,'dnn_ctr424_View_TreeView1n0');" id="dnn_ctr424_View_TreeView1n0" style="border-style:none;font-size:1em;"&gt;2015&lt;/a&gt;
  </code></pre>
  
  <p>Leafnode:</p>
  
  <pre><code>&lt;a class="dnn_ctr424_View_TreeView1_0 leafNode dnn_ctr424_View_TreeView1_5" href="http://localhost:49357/newsletter/?newsID=5/test-dec" id="dnn_ctr424_View_TreeView1n1" style="border-style:none;font-size:1em;"&gt;14  December&lt;/a&gt;
  </code></pre>