473,320 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

TreeView and .css files

I have the following code in an .net 2.0 project:

<asp:Panel Runat="server" id="pnlNavigation" CssClass="pnlNavigation"
Width="165px">
<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataSource1" CssClass="nav" BorderStyle="None"
CollapseImageToolTip="" ExpandImageToolTip="" ShowExpandCollapse="False">
<LevelStyles>
<asp:TreeNodeStyle CssClass="homenav" Font-Underline="False"
/>
<asp:TreeNodeStyle CssClass="mainnav" Font-Underline="False"
Font-Size="11pt" />
<asp:TreeNodeStyle CssClass="mainnavsub"
Font-Underline="False" Font-Size="10pt" />
</LevelStyles>
<LeafNodeStyle CssClass="mainnav" BorderStyle="None" />
<NodeStyle VerticalPadding="2px" HorizontalPadding="5px" />
</asp:TreeView>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</asp:Panel>

The problem is that when displayed, the font sizes are not coming through as
set in the properties.

Any ideas?

Thanks.
Jan 27 '06 #1
3 11194
Hi Acsla,

Welcome to the ASPNET newsgroup.

As for the TreeView node style problem, based on my local tests, the
TreeNode style properties should work as expected. I'm thinking whether it
is possibly that the css style sheet's font setting override the
servercontrol's font setting. Have you tried setting the font properties in
TreeView without apply css style? Also, for root node and leafNodes, we
should use

<RootNodeStyle .........../> and <LeafNodeStyle ........ /> specific
setting.

For other levels node, just can use the LevelStyles collection. Here is my
test page's Treeview template:

(I haven't include the css sheet file in the page)
=======================

<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataSource1" CssClass="nav" BorderStyle="None"
CollapseImageToolTip="" ExpandImageToolTip="" ShowExpandCollapse="False">
<LevelStyles>
<asp:TreeNodeStyle CssClass="homenav"
Font-Underline="False" Font-Size="5" ForeColor="black" />
<asp:TreeNodeStyle CssClass="mainnav"
Font-Underline="False" Font-Size="14pt" ForeColor="green" />
<asp:TreeNodeStyle CssClass="mainnavsub"
Font-Underline="False" Font-Size="18pt" ForeColor="yellow" />
</LevelStyles>

<LeafNodeStyle BorderStyle="None" Font-Size="24"
ForeColor="pink" />
<NodeStyle VerticalPadding="2px" HorizontalPadding="5px"
ForeColor="blue" />
</asp:TreeView>
====================

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: TreeView and .css files
| thread-index: AcYjfUuMj8vSjTzfSvSCSLjdiiCBWg==
| X-WBNR-Posting-Host: 216.117.194.109
| From: "=?Utf-8?B?R2VyaGFyZA==?=" <ac***@community.nospam>
| Subject: TreeView and .css files
| Date: Fri, 27 Jan 2006 12:07:27 -0800
| Lines: 27
| Message-ID: <70**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.general
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.general:187406
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| I have the following code in an .net 2.0 project:
|
| <asp:Panel Runat="server" id="pnlNavigation" CssClass="pnlNavigation"
| Width="165px">
| <asp:TreeView ID="TreeView1" runat="server"
| DataSourceID="SiteMapDataSource1" CssClass="nav" BorderStyle="None"
| CollapseImageToolTip="" ExpandImageToolTip="" ShowExpandCollapse="False">
| <LevelStyles>
| <asp:TreeNodeStyle CssClass="homenav"
Font-Underline="False"
| />
| <asp:TreeNodeStyle CssClass="mainnav"
Font-Underline="False"
| Font-Size="11pt" />
| <asp:TreeNodeStyle CssClass="mainnavsub"
| Font-Underline="False" Font-Size="10pt" />
| </LevelStyles>
| <LeafNodeStyle CssClass="mainnav" BorderStyle="None" />
| <NodeStyle VerticalPadding="2px" HorizontalPadding="5px" />
| </asp:TreeView>
| <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
| </asp:Panel>
|
| The problem is that when displayed, the font sizes are not coming through
as
| set in the properties.
|
| Any ideas?
|
| Thanks.
|

Jan 30 '06 #2
Thanks.

The question then becomes, why would something else in the .css file
override this, as this is being assigned specifically to a control? My
understanding of .css is that specific class assigned to an object takes
presidence. And if a control is assigned a specific attribute, the .css file
shouldn't override.

When I do a View Source on one of the lines I get the following:

<td class="ctl00_Navigation1_TreeView1_1 mainnavsub
ctl00_Navigation1_TreeView1_9 mainnav ctl00_Navigation1_TreeView1_3"
style="white-space:nowrap;"><a class="ctl00_Navigation1_TreeView1_0
mainnavsub ctl00_Navigation1_TreeView1_8 mainnav
ctl00_Navigation1_TreeView1_2" href="/HealthProPartners/Clinical.aspx"
title="Clinical" id="ctl00_Navigation1_TreeView1n6"
style="border-style:none;font-size:1em;">Clinical</a></td>

Note that the stye shows font-size:1em (shouldn't it be "10pt" which I
set?). If I save the ViewSource file, the edit the font-size to what
expected, it shows up correctly. Seems to me there is a bug in generating
the html where the font size should be what is entered in TreeNodeStyle.

The other question is what is class ctl00_Navigation1_TreeView1_1? That
shows up in the class for the object before the class I specifically
assigned. Would that be overriding what I am doing?

Am I missing something?

Thanks.

"Steven Cheng[MSFT]" wrote:
Hi Acsla,

Welcome to the ASPNET newsgroup.

As for the TreeView node style problem, based on my local tests, the
TreeNode style properties should work as expected. I'm thinking whether it
is possibly that the css style sheet's font setting override the
servercontrol's font setting. Have you tried setting the font properties in
TreeView without apply css style? Also, for root node and leafNodes, we
should use

<RootNodeStyle .........../> and <LeafNodeStyle ........ /> specific
setting.

For other levels node, just can use the LevelStyles collection. Here is my
test page's Treeview template:

(I haven't include the css sheet file in the page)
=======================

<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataSource1" CssClass="nav" BorderStyle="None"
CollapseImageToolTip="" ExpandImageToolTip="" ShowExpandCollapse="False">
<LevelStyles>
<asp:TreeNodeStyle CssClass="homenav"
Font-Underline="False" Font-Size="5" ForeColor="black" />
<asp:TreeNodeStyle CssClass="mainnav"
Font-Underline="False" Font-Size="14pt" ForeColor="green" />
<asp:TreeNodeStyle CssClass="mainnavsub"
Font-Underline="False" Font-Size="18pt" ForeColor="yellow" />
</LevelStyles>

<LeafNodeStyle BorderStyle="None" Font-Size="24"
ForeColor="pink" />
<NodeStyle VerticalPadding="2px" HorizontalPadding="5px"
ForeColor="blue" />
</asp:TreeView>
====================

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: TreeView and .css files
| thread-index: AcYjfUuMj8vSjTzfSvSCSLjdiiCBWg==
| X-WBNR-Posting-Host: 216.117.194.109
| From: "=?Utf-8?B?R2VyaGFyZA==?=" <ac***@community.nospam>
| Subject: TreeView and .css files
| Date: Fri, 27 Jan 2006 12:07:27 -0800
| Lines: 27
| Message-ID: <70**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.general
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.general:187406
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| I have the following code in an .net 2.0 project:
|
| <asp:Panel Runat="server" id="pnlNavigation" CssClass="pnlNavigation"
| Width="165px">
| <asp:TreeView ID="TreeView1" runat="server"
| DataSourceID="SiteMapDataSource1" CssClass="nav" BorderStyle="None"
| CollapseImageToolTip="" ExpandImageToolTip="" ShowExpandCollapse="False">
| <LevelStyles>
| <asp:TreeNodeStyle CssClass="homenav"
Font-Underline="False"
| />
| <asp:TreeNodeStyle CssClass="mainnav"
Font-Underline="False"
| Font-Size="11pt" />
| <asp:TreeNodeStyle CssClass="mainnavsub"
| Font-Underline="False" Font-Size="10pt" />
| </LevelStyles>
| <LeafNodeStyle CssClass="mainnav" BorderStyle="None" />
| <NodeStyle VerticalPadding="2px" HorizontalPadding="5px" />
| </asp:TreeView>
| <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
| </asp:Panel>
|
| The problem is that when displayed, the font sizes are not coming through
as
| set in the properties.
|
| Any ideas?
|
| Thanks.
|

Jan 30 '06 #3
Hi Acsla,

Thanks for your response.
As for css style, there could have many text size related setting which can
affect the text in page or sub html elements. e.g. the text style for whole
page or for table's content may also affect the TreeView. However, I think
if we explicitly set the font size through the TreeView's certain
XXXNodeStyle, that should be able to override the css attributes.

In addition, as for the "ctl00_Navigation1_TreeView1_0_xxx" like css class
name, they're auto generated by ASP.NET server control's code which point
to some buildin styles which may contains some attributes for other html
element style definiation. I don't think this will conflict with our
customized style setting. To test this, if the TreeView xxxNodeStyle works
well when no css style is linked, we can try removing the css style setting
in linked css file step by step to see what setting in css file broke the
server control's style setting.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Feb 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jeroen Ceuppens | last post by:
Hi, I want to make something that adds a TreeNode to the end of TreeView, that TreeView Looks like + Level 1 + Level 2 + Level 3 - Level last
2
by: Trond Hoiberg | last post by:
Let say i have a bunch of files. Logfiles that is stored in subfolders. Folder1 --logfile1 --logfile2 --logfile3 Folder2 --logfile1 --logfile2 I want to display these files using data from...
0
by: DKode | last post by:
Ok, I am creating a directory browsing app and am using the obout.com TreeView control. This is exactly what I was looking for, as of right now my code is quite sloppy and I plan on cleaning it...
6
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview....
0
by: Treeview Trouble | last post by:
I have an application where there are two radio buttons each of which populates a treeview control with a directory structure. Each radio button corresponds to a different directory which may or...
2
by: engwar1 | last post by:
I'm a .Net newbie and have started writing a Windows Forms application to assist me in choosing files/directories to move from one drive to another. Basically what I want is something like the...
0
by: Mufasa | last post by:
I have a website that I've developed with a treeview that works fine on the development environment. I then copy it to our production server and the tree view won't work. One of the things I did...
8
by: sphinney | last post by:
Hello. I'm using a treeview control on my Access 2007 form. The treeview will be used to show the directory structure of a given file path. I've been able to successfully populate the nodes on the...
1
by: kashif73 | last post by:
Hi I am pretty new to ASP.NET. I have inserted a Treeview control in my page, which display directory information & all the different files contained in it in a DataList infront of it. My question is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.