Saturday, March 24, 2012

Setting StyleSheet link from a MasterPage

I want to insert a CSS Stylesheet file in a <LINK> tag 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 <head> section 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.nospam> wrote:
> I want to insert a CSS Stylesheet file in a <LINK> tag inside my MasterPag
e
> 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 <head> section 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 pa
th,
> 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 C
SS
> 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:

> On Jun 28, 11:10 pm, Alex Maghen <AlexMag...@.newsgroup.nospam> wrote:
> get rid of (~)
>
On Jun 29, 12:06 am, Alex Maghen <AlexMag...@.newsgroup.nospam> wrote:
> I can't get rid of the "~". If I do, it will resolve to the doroot, not th
e
> application root. And while that works in the live environment, it does no
t
> 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:

> On Jun 29, 12:06 am, Alex Maghen <AlexMag...@.newsgroup.nospam> wrote:
> 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.nospam> wrote:
> Okay, guess what - strangest thing just happened: I quit Visual Studio an
d
> then started it again and now it all works perfectly. What on earth is *th
at*
> 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.com> wrote:
> On Jun 28, 11:10 pm, Alex Maghen <AlexMag...@.newsgroup.nospam> wrote:
>
>
>
>
>
>
>
>
> get rid of (~)- Hide quoted text -
> - Show quoted text -

0 comments:

Post a Comment