Click here to Skip to main content
15,868,292 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

Please tell me how to set colors for selected treeview node(even multi-selection also)

Thank you
Posted

 
Share this answer
 
XML
/* Styles: put this at style section or at your .css file */
.rootNodeLinkStyle a:link
{
    color: Red;
}

.rootNodeLinkStyle a:hover
{
    color: pink;
    text-decoration:underline;
}

In .aspx: add the css class to the RootNodeStyle as below:

<asp:TreeView ID="trvPILDeepSearch" runat="server" ImageSet="Simple" BackColor="#F8F8F8" BorderWidth="5px" BorderColor="#F8F8F8" LeafNodeStyle-CssClass="leafnode" Width="600px" >
    <DataBindings>
        <asp:TreeNodeBinding DataMember="Parent" TextField="TEXT" SelectAction="None"  />
        <asp:TreeNodeBinding DataMember="Child" TextField="TEXT" SelectAction="None" />
    </DataBindings>
    <RootNodeStyle CssClass="rootNodeLinkStyle" />
</asp:TreeView>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900