views:

24

answers:

2

I'm working on an ASP.net 2.0 application.

The master stylesheet contains:

BODY TR
{
     background-color: #e5e4e4;
}

In a page I'm creating for the site I have an:

<asp:TreeView>

Each line in the TreeView renders as a <table>. Each table contains a <tr> which picks up on the background colour in the stylesheet. I don't want them to.

By giving my <asp:TreeView> the following:

ForeColor="black"
LeafNodeStyle-BackColor="white"
NodeStyle-BackColor="White"
ParentNodeStyle-BackColor="White"
RootNodeStyle-BackColor="White"
BackColor="White" BorderColor="White"
style="background-color:White;"

I can get most of it to render with a white background. The <td>s that contain data have this as their style:

white-space: nowrap; background-color: White;

The <td>s that contain no data and are used to indent nodes still have the unwanted background colour.

How can I style the intent <td>s or override the stylesheet?

Thanks in advance.

A: 
table tr td
{
     background-color: white;
}
TheGeekYouNeed
Surely this would affect all tables in the entire application? I can't make sweeping changes like that...
Cosmic Flame
add a class to those tables that you need white backgrounds for. for exampple, class whiteTabletable.whiteTable tr td{ background-color:white;}
TheGeekYouNeed
+1  A: 

Just use

<asp:Treeview CssClass="myTreeClass">

and define in CSS

body .myTreeClass tr{background-color:white;}

Gaby
This works, thank you.
Cosmic Flame