How to make a treeview transparent

Hi - I have made a simple web part (server control) for sharepoint that has a tree view on it.  I have set the web parts background image to an image and want to see the image through the tree view.  It happened once but then stopped working.  
I have tried setting the backcolor to color.transparent but this doesn't work.
I am using an associated css style sheet and a javascript js file as well if that helps.
millerthegorillaAsked:
Who is Participating?
 
Dustin HopkinsSenior Web DeveloperCommented:
ok this seemed to work, i tested it in ie7 and firefox.
here is the style class:
 <style type="text/css">
    .trans{
     filter:alpha(opacity=80);/*Semi-Transparency for IE*/
     -moz-opacity:0.8;/*Semi-Transparency for Mozilla*/
     opacity:0.8;/*Semi-Transparency for Gecko*/
}
    </style>

then just apply it to your treeview
<asp:TreeView ID="TreeView1" runat="server" CssClass="trans" BackColor="#333300" 
            ImageSet="Simple" ShowLines="True" Width="300px"></asp:TreeView>

Open in new window

0
 
Dustin HopkinsSenior Web DeveloperCommented:
Which part of the treeview are you wanting to show transparent?
you could use this css and apply it to which ever nodes you want to be transparent, not sure about applying it to the images though.
<style  type="text/css">
    .trans{
    filter: alpha(opacity=50);
    -moz-opacity: 0.5;
    }
    </style>

then just apply this class like below
<RootNodeStyle  cssclass="trans" />
            <ParentNodeStyle Font-Bold="False" cssclass="trans"  />
            <HoverNodeStyle Font-Underline="True" ForeColor="Purple" cssclass="trans" />

Open in new window

0
 
millerthegorillaAuthor Commented:
Hi - I am trying to use a c# treeview and make its background transparent.  Thanks for your help though.
What is the xml for in the code that you submitted?  Is it xsl?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Dustin HopkinsSenior Web DeveloperCommented:
No, those are the node style attributes in the treeview.
Theoretically if you apply the css class to the treeview then it should make it trasparent, however for the life of me i can't get it to work in the browser...i'll work on it a little more and post back if i find a solution.
0
 
millerthegorillaAuthor Commented:
Hi - I turned on my pc this morning and went to the site with the treeview and it was working fine?!  I didn't change anything and the background was showing through.  The only thing that I can think is that it is a bug in the tree view control. I'm loathe to touch it for fear of breaking it.  I'd like to implement your suggestion though so I'll create a new version.  I'll be back when I've tried it.  
0
 
millerthegorillaAuthor Commented:
Hi - I tried it but it doesn't work.  It seems that IE (which I've got to use) isn't accepting the filter style.  I am using sharepoint designer to edit the css and when I enter 'filter' or any other opacity command sharepoint designer underlines it in red and complains that the 'property is invalid because its not supported by the current schema'.  I didn't know stylesheets had schemas.  I presume its referring to the schema on the sharepoint master page.
Thanks for your help anyway.  Have some points :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.