469,922 Members | 2,149 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,922 developers. It's quick & easy.

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 3412
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by allard poldermans | last post: by
2 posts views Thread by wjbell | last post: by
1 post views Thread by Daves | last post: by
7 posts views Thread by sasquatch | last post: by
4 posts views Thread by Barry | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.