Saturday, March 24, 2012

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?

AlexOn Jun 28, 11:10 pm, Alex Maghen <AlexMag...@.newsgroup.nospamwrote:

Quote:

Originally Posted by

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="http://links.10026.com/?link=~/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 (~)
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:

Quote:

Originally Posted by

On Jun 28, 11:10 pm, Alex Maghen <AlexMag...@.newsgroup.nospamwrote:

Quote:

Originally Posted by

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="http://links.10026.com/?link=~/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 (~)
>
>


On Jun 29, 12:06 am, Alex Maghen <AlexMag...@.newsgroup.nospamwrote:

Quote:

Originally Posted by

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?
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:

Quote:

Originally Posted by

On Jun 29, 12:06 am, Alex Maghen <AlexMag...@.newsgroup.nospamwrote:

Quote:

Originally Posted by

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?
>
>


On Jun 29, 1:32 am, Alex Maghen <AlexMag...@.newsgroup.nospamwrote:

Quote:

Originally Posted by

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
Hi alexey

try this working fine for me
\

place it in master page

<link rel="stylesheet" href="http://links.10026.com/?link=../../Common/CSS/main.css"
media="screen,projection"
type="text/css" />

ganesh

On Jun 29, 2:23 am, Alexey Smirnov <alexey.smir...@.gmail.comwrote:

Quote:

Originally Posted by

On Jun 28, 11:10 pm, Alex Maghen <AlexMag...@.newsgroup.nospamwrote:
>
>
>
>
>

Quote:

Originally Posted by

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).


>

Quote:

Originally Posted by

I tried adding
<link type="text/css" rel="stylesheet"
href="http://links.10026.com/?link=~/Shared/CSS/Standard.css" runat="server" />


>

Quote:

Originally Posted by

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.


>

Quote:

Originally Posted by

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.


>

Quote:

Originally Posted by

Any ideas?


>

Quote:

Originally Posted by

Alex


>
get rid of (~)- Hide quoted text -
>
- Show quoted text -

0 comments:

Post a Comment