Anyone ever run into styles not apply to a master page app when run, yet they apply in VS design mode? Even when in design mode of the content pages, VS applies the style. But as soon as you run the app, IE won't apply the styles. And 'yes'... I've hit
<ctrl>+r to force a reload of the page in IE.
I dragged and dropped the style sheet to the master page in design mode. Then, in source mode, I edit the link tag's href to be root relative. Still no joy.
First, try removing the tilda in the href. If that doesn't work it's probably looking in the wrong directory. Try to browse to the css file in your browser with the absolute path. When you find it put the absolute path in your master. If that works then
you can probably figure out the relative from the absolute.
this one wont work <link
rel="~/Stylesheet"
type="text/css"
href="~/StyleSheet.css"
/>
if its not running on the server "~/" insted do one of the following href="Stylesheet.css" or make it run on server <link rel="~/Stylesheet" type="text/css" href="~/stylesheet.css" runat="server" id="style" />
hope it helps
===================================
Please don't forget to mark as "Answered". Thanks
Please, don't forget to mark as "Answered" if it helped you. Thanks.
Second, I noticed a typo in my original post. To accurately reflect the code in my master page, the link tag should have read:
<
link
href="~/StyleSheet.css"
rel="stylesheet"
type="text/css"
/>
The tilda and slash in rel="~/stylesheet" was not in my mark up.
jamesqua, I tried removing the ~/ from the href attribute, but it didn't help. I also checked the physical folder and found that the my stylesheet, master page and the content page ALL reside in the same folder. I tried setting the href to the absolute
address as you suggested and this works fine. Obviously, that isn't an acceptable solution and I'm unable to find the problem. Is it possible that it has to do with the fact this master page is a login app? The content page being loaded is a protected page
so naturally the app defaults to login.aspx. Even the protected page is in the same folder as the rest of the files.
Venkat, the "../" notation didn't work.
Stojan, I tried your suggestion as well. Likewise, it didn't work.
Hmm wiered! Try to browse the css file in your browser as was suggested and try also to run the page in other browser like FF to see does the styles are applied if so ... browser issue(settings could disable styles).
chipwitch
Member
142 Points
95 Posts
External css file not working in master page.
Mar 19, 2009 02:26 PM|LINK
Anyone ever run into styles not apply to a master page app when run, yet they apply in VS design mode? Even when in design mode of the content pages, VS applies the style. But as soon as you run the app, IE won't apply the styles. And 'yes'... I've hit <ctrl>+r to force a reload of the page in IE.
I dragged and dropped the style sheet to the master page in design mode. Then, in source mode, I edit the link tag's href to be root relative. Still no joy.
<link rel="~/Stylesheet" type="text/css" href="~/StyleSheet.css" />Any suggestions?
Sherri
jamesqua
Star
8305 Points
1430 Posts
Re: External css file not working in master page.
Mar 19, 2009 02:39 PM|LINK
sappidireddy
Participant
917 Points
221 Posts
Re: External css file not working in master page.
Mar 19, 2009 02:40 PM|LINK
<
link href="../StyleSheet.css" rel="stylesheet" type="text/css" />Venkat
Dont forget to click "Mark as Answer" on the post that helped you
Stoian Bucov...
Participant
1685 Points
265 Posts
Re: External css file not working in master page.
Mar 19, 2009 02:41 PM|LINK
Hi,
this one wont work <link rel="~/Stylesheet" type="text/css" href="~/StyleSheet.css" /> if its not running on the server "~/" insted do one of the following href="Stylesheet.css" or make it run on server <link rel="~/Stylesheet" type="text/css" href="~/stylesheet.css" runat="server" id="style" />
hope it helps
===================================
Please don't forget to mark as "Answered". Thanks
AlexanderSha...
Member
21 Points
21 Posts
Re: External css file not working in master page.
Mar 19, 2009 03:10 PM|LINK
You can also solve the problem with this aproach
href="<%=ResolveClientUrl("~/StyleSheet.css") %>"
chipwitch
Member
142 Points
95 Posts
Re: External css file not working in master page.
Mar 19, 2009 03:33 PM|LINK
First, thanks to all for the suggestions. :-)
Second, I noticed a typo in my original post. To accurately reflect the code in my master page, the link tag should have read:
<
link href="~/StyleSheet.css" rel="stylesheet" type="text/css" />The tilda and slash in rel="~/stylesheet" was not in my mark up.
jamesqua, I tried removing the ~/ from the href attribute, but it didn't help. I also checked the physical folder and found that the my stylesheet, master page and the content page ALL reside in the same folder. I tried setting the href to the absolute address as you suggested and this works fine. Obviously, that isn't an acceptable solution and I'm unable to find the problem. Is it possible that it has to do with the fact this master page is a login app? The content page being loaded is a protected page so naturally the app defaults to login.aspx. Even the protected page is in the same folder as the rest of the files.
Venkat, the "../" notation didn't work.
Stojan, I tried your suggestion as well. Likewise, it didn't work.
So, jamesqua, now where should I look?
Sherri
chipwitch
Member
142 Points
95 Posts
Re: External css file not working in master page.
Mar 19, 2009 03:44 PM|LINK
Tried it... no luck
Also, from code behind, I checkedServer.MapPath("~/")
and I'm getting the correct absolute path (it matches the physical folder of the css file)
Sherri
jamesqua
Star
8305 Points
1430 Posts
Re: External css file not working in master page.
Mar 19, 2009 03:56 PM|LINK
When you navigate to the absolute path in the browser does the css file show up?
Stoian Bucov...
Participant
1685 Points
265 Posts
Re: External css file not working in master page.
Mar 19, 2009 04:41 PM|LINK
Hmm wiered! Try to browse the css file in your browser as was suggested and try also to run the page in other browser like FF to see does the styles are applied if so ... browser issue(settings could disable styles).
Hope it helps
===========================
Please don't forget to mark as "Answered". Thanks
Provided by: www.snb-bg.com
vora_bhaumik
Contributor
2043 Points
340 Posts
Re: External css file not working in master page.
Mar 20, 2009 06:21 AM|LINK
Hi Friend,
Just look in to it may be it will be helpful for you.
<head runat="server">
<title>Titel</title>
<link href="../App_Themes/index_sytle.css" rel="stylesheet" type="text/css" />
</head>
Enjoy [:)]
Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
Regards,
Bhaumik