473,396 Members | 2,002 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,396 software developers and data experts.

Setting StyleSheet link from a MasterPage

I want to insert a CSS Stylesheet file in a <LINKtag inside my MasterPage
so that it will work in all of the the ASPX pages that use that MasterPage
(no matter where the page is in the directory hierarchy).

I tried adding
<link type="text/css" rel="stylesheet"
href="~/Shared/CSS/Standard.css" runat="server" />

in the <headsection of the MasterPage. When I look at the source of my
pages later when I'm running it, it *does* seem to resolve to the right path,
but my styles are not applied.

I know no way of debugging the linking of these things so I don't really
know why it's not finding my stylesheet.css file. Also, I've testing the CSS
file with plain HTML and it works fine.

Any ideas?

Alex
Jun 28 '07 #1
6 3572
On Jun 28, 11:10 pm, Alex Maghen <AlexMag...@newsgroup.nospamwrote:
I want to insert a CSS Stylesheet file in a <LINKtag inside my MasterPage
so that it will work in all of the the ASPX pages that use that MasterPage
(no matter where the page is in the directory hierarchy).

I tried adding
<link type="text/css" rel="stylesheet"
href="~/Shared/CSS/Standard.css" runat="server" />

in the <headsection of the MasterPage. When I look at the source of my
pages later when I'm running it, it *does* seem to resolve to the right path,
but my styles are not applied.

I know no way of debugging the linking of these things so I don't really
know why it's not finding my stylesheet.css file. Also, I've testing the CSS
file with plain HTML and it works fine.

Any ideas?

Alex
get rid of (~)

Jun 28 '07 #2
I can't get rid of the "~". If I do, it will resolve to the doroot, not the
application root. And while that works in the live environment, it does not
work in run-time in Visual Studio - and I need that.

"Alexey Smirnov" wrote:
On Jun 28, 11:10 pm, Alex Maghen <AlexMag...@newsgroup.nospamwrote:
I want to insert a CSS Stylesheet file in a <LINKtag inside my MasterPage
so that it will work in all of the the ASPX pages that use that MasterPage
(no matter where the page is in the directory hierarchy).

I tried adding
<link type="text/css" rel="stylesheet"
href="~/Shared/CSS/Standard.css" runat="server" />

in the <headsection of the MasterPage. When I look at the source of my
pages later when I'm running it, it *does* seem to resolve to the right path,
but my styles are not applied.

I know no way of debugging the linking of these things so I don't really
know why it's not finding my stylesheet.css file. Also, I've testing the CSS
file with plain HTML and it works fine.

Any ideas?

Alex

get rid of (~)

Jun 28 '07 #3
On Jun 29, 12:06 am, Alex Maghen <AlexMag...@newsgroup.nospamwrote:
I can't get rid of the "~". If I do, it will resolve to the doroot, not the
application root. And while that works in the live environment, it does not
work in run-time in Visual Studio - and I need that.
Apologies! I see it now...

Regarding your last post, do you mean that in the live environment you
do get the CSS working properly?

Jun 28 '07 #4
Okay, guess what - strangest thing just happened: I quit Visual Studio and
then started it again and now it all works perfectly. What on earth is *that*
all about??

Anyway, I guess it's resolved.

Thanks.

Alex


"Alexey Smirnov" wrote:
On Jun 29, 12:06 am, Alex Maghen <AlexMag...@newsgroup.nospamwrote:
I can't get rid of the "~". If I do, it will resolve to the doroot, not the
application root. And while that works in the live environment, it does not
work in run-time in Visual Studio - and I need that.

Apologies! I see it now...

Regarding your last post, do you mean that in the live environment you
do get the CSS working properly?

Jun 28 '07 #5
On Jun 29, 1:32 am, Alex Maghen <AlexMag...@newsgroup.nospamwrote:
Okay, guess what - strangest thing just happened: I quit Visual Studio and
then started it again and now it all works perfectly. What on earth is *that*
all about??

Anyway, I guess it's resolved.
it might happen sometimes with the editor, close the file and open it
again

Jun 29 '07 #6
Hi alexey

try this working fine for me
\

place it in master page

<link rel="stylesheet" href="../../Common/CSS/main.css"
media="screen,projection"
type="text/css" />
ganesh
On Jun 29, 2:23 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jun 28, 11:10 pm, Alex Maghen <AlexMag...@newsgroup.nospamwrote:


I want to insert a CSS Stylesheet file in a <LINKtag inside my MasterPage
so that it will work in all of the the ASPX pages that use that MasterPage
(no matter where the page is in the directory hierarchy).
I tried adding
<link type="text/css" rel="stylesheet"
href="~/Shared/CSS/Standard.css" runat="server" />
in the <headsection of the MasterPage. When I look at the source of my
pages later when I'm running it, it *does* seem to resolve to the right path,
but my styles are not applied.
I know no way of debugging the linking of these things so I don't really
know why it's not finding my stylesheet.css file. Also, I've testing the CSS
file with plain HTML and it works fine.
Any ideas?
Alex

get rid of (~)- Hide quoted text -

- Show quoted text -

Jun 29 '07 #7

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

Similar topics

3
by: allard poldermans | last post by:
How can I make a reference to an external CSS or JS file that is relative to the XSL stylesheet, and not relative to the XML data? If you simply put : <link rel="stylesheet" type="text/css"...
2
by: wjbell | last post by:
I have a piece of javascript I need to modify. Right now it changes a stylesheet in the document between style.css and no_indent.css. These are in the head of my document: <link rel=stylesheet...
12
by: Dave Hammond | last post by:
I recently noticed the stylesheet link in an html page had the href set to a PHP script, as in: <LINK REL="stylesheet" href="some_css.php" type="text/css"> Presumably the file being referenced...
12
by: Andy Jeffries | last post by:
Hi all, I want to write a function that given two elements will make their heights equal to the larger element. I've had a go at it and it works, but it makes both their heights larger than...
1
by: Daves | last post by:
I am using 2.0 masterpages. All content pages use some common variables, for example the DB connection string. Also some pages return links which are located in a "sublink" area in the masterpage....
7
by: sasquatch | last post by:
Hi, I've a a site with nested master pages and content pages. I tried using a theme with a stylesheet in the app_themes directory referencing it in the web.config file from a pages tag theme...
12
by: Mark Rae | last post by:
Hi, It's easy enough for a child page to manipulate its MasterPage's header simply by modifying the MasterPage thus: <header runat="server"> .... .... </header>
4
by: Barry | last post by:
Hello. I am in the process of modifying some JavaScript code which refers to an external stylesheet, but unfortunately I have very little previous JavaScript experience. Currently the code has only...
8
by: Jeff | last post by:
ASP.NET 2.0 I'm wondering how to set the color of a visited HyperLinkField (the link text) in a GridView?? Here is the markup of the HyperLinkField I have problems with: <asp:HyperLinkField...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.