Welcome Guest Search | Active Topics | Log In | Register

New .css stylesheet reference in <head> tag causing error Options · View
ahsan
#1 Posted : Tuesday, May 20, 2008 10:17:19 PM

Rank: YAF Forumling


Joined: 5/13/2008
Posts: 8
Per an earlier post I was successful in dropping a Site.master on top of the default.aspx that YAF runs off of. However, when I add a new stylesheet to the <head> tag I get the following error:

There has been a serious error loading the forum. No futher information is available.

Please contact the administrator if this message persists.


I don't understand why adding a reference to a stylesheet would break the forum. I am hoping to use this simple .css file in addition to the YAF thematic CSS files specifically to handle the layout of my Site.master.
Jaben
#2 Posted : Wednesday, May 21, 2008 1:26:57 AM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 2,946
Location: Honolulu, HI
Turn customErrors "Off" in web.config and then tell us the real error...

<customErrors mode="Off" />

Also, provide the exact <head></head> code here so we can see more what's wrong.

It's really hard to help if you don't help us understand the situation...
"When you are grateful, fear disappears and abundance appears”."

ahsan
#3 Posted : Wednesday, May 21, 2008 4:35:29 PM

Rank: YAF Forumling


Joined: 5/13/2008
Posts: 8
Fixed the error by adding the css as a control to YafHead (the header object) in the code behind. In response to your question, I was originally trying the following:

Code:
<head id="YafHead" runat="server">
      <link href="<%= Page.ResolveUrl("~/public/stylesheets/Main.css") %>" rel="stylesheet" type="text/css" />
</head>


I removed the offending <link> tag and replaced it with the following in my Site.master code behind to make it work:

Code:
        if (!IsPostBack)
        {
            HtmlLink _css = new HtmlLink();
            _css.Href = "public/stylesheets/Main.css";
            _css.Attributes.Add("type", "text/css");
            _css.Attributes.Add("rel", "stylesheet");

            YafHead.Controls.Add(_css);
        }
ahsan
#4 Posted : Wednesday, May 21, 2008 7:18:39 PM

Rank: YAF Forumling


Joined: 5/13/2008
Posts: 8
After further testing, I had to remove the IsPostBack check as the stylesheet became lost on a couple pages.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.3 RC2 | YAF © 2003-2008, Yet Another Forum.NET
This page was generated in 0.070 seconds.

SourceForge.net Logo Powered by ASP.NET v2.0 411ASP.NET