Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

CSS in MasterPages

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rbrt - 03 Dec 2007 20:15 GMT
I have a master page I want to use a CSS stylesheet for. I put the link tag
in the master page markup, like this     <link href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas? This
is kind of baffling.
Scott Roberts - 03 Dec 2007 20:38 GMT
Is the content page in a different folder than the master page? Try an
absolute path in your css link. Or better yet, use Themes.

>I have a master page I want to use a CSS stylesheet for. I put the link tag
> in the master page markup, like this     <link href="Styles/MyStyle.css"
[quoted text clipped - 5 lines]
> This
> is kind of baffling.
Rbrt - 03 Dec 2007 20:56 GMT
Both are in the same folder. I've tried to use themes. That doesn't work
either.

> Is the content page in a different folder than the master page? Try an
> absolute path in your css link. Or better yet, use Themes.
[quoted text clipped - 8 lines]
> > This
> > is kind of baffling.
David Wier - 04 Dec 2007 15:17 GMT
What exactly do you mean, regarding themes, that they 'don't work'

When the Master page includes the exact correct theme, I have had no
problems using themes with CSS files.
Of course, I assign my theme in the Web.config file

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup

> Both are in the same folder. I've tried to use themes. That doesn't work
> either.
[quoted text clipped - 14 lines]
>> > This
>> > is kind of baffling.
Rbrt - 05 Dec 2007 11:18 GMT
Skins do work, but CSS does not. I am declaring the theme in the Content page
and have EnableTheming=true in both Master and Content pages. I did try
declaring it in the web.comfig and it made no difference.

CSS will work at design time only if I put a <link rel....> declaration in
the Master Page. At run time, the markup disappears.

> What exactly do you mean, regarding themes, that they 'don't work'
>
[quoted text clipped - 25 lines]
> >> > This
> >> > is kind of baffling.
Scott Roberts - 05 Dec 2007 17:03 GMT
I can understand your frustration, but rest assured that CSS *does* work.
It's just not working for you. ;)

What I usually do when I have a particularly frustrating problem is try to
create a very simple project that exhibits the problem. You can then share
that simple project with the community and they can help you troubleshoot.
More often than not, I am *unable* to duplicate my problem in a new, simple
project - which means that I've got something whacked in my big, complicated
project. Then it's a matter of finding out "what's different".

Perhaps you could try that. Create a simple web project (no security or
anything) and see if your CSS file works. Assuming it does, keep adding
things to your sample until it breaks. Then share that project with us.

Scott

> Skins do work, but CSS does not. I am declaring the theme in the Content
> page
[quoted text clipped - 37 lines]
>> >> > This
>> >> > is kind of baffling.
Rbrt - 03 Dec 2007 21:20 GMT
What is frustrating is that if I use themes and look at the source of the
page I can see that the Styleheet is being inked in as it is supposed to be.
It just isn't doing anything.

> Is the content page in a different folder than the master page? Try an
> absolute path in your css link. Or better yet, use Themes.
[quoted text clipped - 8 lines]
> > This
> > is kind of baffling.
Scott Roberts - 03 Dec 2007 23:32 GMT
Do you have security on the folders holding the CSS and/or Theme files?

> What is frustrating is that if I use themes and look at the source of the
> page I can see that the Styleheet is being inked in as it is supposed to
[quoted text clipped - 16 lines]
>> > This
>> > is kind of baffling.
Rbrt - 04 Dec 2007 11:16 GMT
I have forms authentication but the web.config file has a location entry for
the css file that should make it accessible. I've played around with it quite
a bit but no luck.

> Do you have security on the folders holding the CSS and/or Theme files?
>
[quoted text clipped - 18 lines]
> >> > This
> >> > is kind of baffling.
Scott Roberts - 04 Dec 2007 16:23 GMT
To verify that your location entry is working, try typing the url to the CSS
file directly into your browser address bar. Do you get an error?

>I have forms authentication but the web.config file has a location entry
>for
[quoted text clipped - 28 lines]
>> >> > This
>> >> > is kind of baffling.
Rbrt - 04 Dec 2007 17:10 GMT
No. It directs me to the logon page. Once I have logged in, I can type the
url of the css into the browser address bar and it asks me if I want to save
it to my hard drive. As I said, it displays the css markup in design view,
but not at runtime.

On the other hand, skins do not show up at design time but do show up at run
time.

Pretty weird.

> To verify that your location entry is working, try typing the url to the CSS
> file directly into your browser address bar. Do you get an error?
[quoted text clipped - 31 lines]
> >> >> > This
> >> >> > is kind of baffling.
SMiGL - 04 Dec 2007 09:04 GMT
> I have a master page I want to use a CSS stylesheet for. I put the link tag
> in the master page markup, like this     <link href="Styles/MyStyle.css"
[quoted text clipped - 4 lines]
> stylesheet markup mysteriously disappears. Does anybody have any ideas? This
> is kind of baffling.

Improve you markup.
<link rel="Stylesheet" href="~/Styles/MyStyle.css" runat="server" />
Rbrt - 04 Dec 2007 11:14 GMT
I have tried every variation of the link markup I can think of. As I said,
the css works in design view. It is just at runtime that it disappears.

> > I have a master page I want to use a CSS stylesheet for. I put the link tag
> > in the master page markup, like this     <link href="Styles/MyStyle.css"
[quoted text clipped - 7 lines]
> Improve you markup.
> <link rel="Stylesheet" href="~/Styles/MyStyle.css" runat="server" />
Rbrt - 04 Dec 2007 12:49 GMT
Well it appears that I can get skins to work but CSS simply will not work no
matter what I do. I am giving up on CSS and instead of defining things like
tables in html, I am using asp, which is a ridiculous increase in server load
but what else can I do? I want to use CSS to save time, but have already
wasted an entire bloody day on this and have to get on with the job.

Very, very frustrating. It is hard to imagine something more basic to web
development than CSS and to have this sort of problem is just not acceptable.

> I have a master page I want to use a CSS stylesheet for. I put the link tag
> in the master page markup, like this     <link href="Styles/MyStyle.css"
[quoted text clipped - 4 lines]
> stylesheet markup mysteriously disappears. Does anybody have any ideas? This
> is kind of baffling.
Hans Nieuwenhuis - 05 Dec 2007 04:30 GMT
Hi,

I have noticed many times that changes in my stylesheets are not immediately
effectuated at runtime...

Internet Explorer has cached a previous version of my stylesheet file then.

I have to manually delete cached files in Internet Explorer: Tools |
Internet Options, tabpage 'general', press 'delete...' in 'Browsing history'
and then press 'delete files...'

After that I press F5 and then my changes are effective.

Hope this helps,

Hans

> Well it appears that I can get skins to work but CSS simply will not work
> no
[quoted text clipped - 19 lines]
>> This
>> is kind of baffling.
Rbrt - 05 Dec 2007 11:24 GMT
Thank you very much for your suggestion. I tried it but it didn't help.

I will keep checking here to see if there are any other suggestions, and I
am grateful for the advice you have all given, but I have to move on with the
project. I am not going to waste any more time on CSS but will put the markup
in the Master pages directly. At least that will provide some level of
reusability and control.

Robert

> Hi,
>
[quoted text clipped - 36 lines]
> >> This
> >> is kind of baffling.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.