473,383 Members | 1,880 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,383 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 11199
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: 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.