Must have a <head runat="server"> Error

Last post 03-07-2008 5:14 AM by eryn. 9 replies.

Sort Posts:

  • Must have a <head runat="server"> Error

    03-02-2006, 10:59 AM
    • Member
      121 point Member
    • leoguy
    • Member since 02-23-2006, 10:00 PM
    • Posts 50

    When i use <atlas:ScriptManager> tag in .aspx or .ascx pages without <head runat =server> , i get the following error. Is this a bug or as designed?

     

    Server Error in '/AtlasWebSite' Application.

    Must have a <head runat="server">

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: Must have a <head runat="server">

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [InvalidOperationException: Must have a <head runat="server">]
       Microsoft.Web.UI.ScriptManager.OnPreRender(EventArgs e) +262
       System.Web.UI.Control.PreRenderRecursiveInternal() +77
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

  • Re: Must have a <head runat="server"> Error

    03-02-2006, 11:31 AM
    • Contributor
      3,585 point Contributor
    • Aidy
    • Member since 09-01-2005, 2:35 PM
    • UK
    • Posts 711
    As designed, you need that runat attribute.
  • Re: Must have a <head runat="server"> Error

    03-02-2006, 11:31 AM
    • Member
      520 point Member
    • LordHits
    • Member since 07-22-2002, 10:22 AM
    • Lisle, IL USA
    • Posts 104
    I got this too (which is easily fixed by making the head runat="server") but is this a requirement on any page using Atlas?
  • Re: Must have a <head runat="server"> Error

    03-02-2006, 11:42 AM
    • All-Star
      118,774 point All-Star
    • XIII
    • Member since 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 13,242
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    LordHits wrote:
    but is this a requirement on any page using Atlas?

    Hi,

    no it isn't. If you're using Themes in ASP.NET 2.0 it's required to have that attribute.

    Grz, Kris.

  • Re: Must have a <head runat="server"> Error

    03-02-2006, 11:50 AM
    • Member
      121 point Member
    • leoguy
    • Member since 02-23-2006, 10:00 PM
    • Posts 50

    But i am not using any themes in my website which is fairly simple ASP.NET 2.0 impelementation. Infact i am using Atlas in .ascx control and .ascx control is loaded first then the page, as a result scripmanager is unable to see the <head runat=server> tag and generates this error.

    Any clue?

     

  • Re: Must have a <head runat="server"> Error

    03-02-2006, 12:15 PM
    • Member
      520 point Member
    • LordHits
    • Member since 07-22-2002, 10:22 AM
    • Lisle, IL USA
    • Posts 104
    XIII wrote:

    Hi,

    no it isn't. If you're using Themes in ASP.NET 2.0 it's required to have that attribute.

    Grz, Kris.

    Ok, but i'm not using themes and I still go that message. I don't know if it matters, but my scriptmanager control resides in a content page as opposed to the master page.

  • Re: Must have a <head runat="server"> Error

    06-01-2006, 4:59 PM
    • Member
      30 point Member
    • gbecavin
    • Member since 06-01-2006, 8:53 PM
    • Posts 6

    Hi,

    I had the same problem. An .aspx page with a placeholder, loading an ascx control in code behind.

    I replace the <head> section in my aspx page with <head id="headSection" runat="server" >,  and now it works.

    As the ascx control had an updatepanel, i had to do the loadcontrol in the page-init method.

    Hope that will solve your pb.

    Gilles

  • Re: Must have a <head runat="server"> Error

    06-01-2006, 6:07 PM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 1:22 AM
    • Madeira [Portugal]
    • Posts 5,368

    hello guys.

    i believe that the head element must be a server element since it's one of the sections that is sent back from the server to the client during a partial postback (ie, it's contents are parsed and send on every partial postback response).

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: Must have a <head runat="server"> Error

    10-11-2006, 2:00 AM
    • Member
      7 point Member
    • ullaskumar_v
    • Member since 10-11-2006, 5:55 AM
    • Posts 2

    Hi,

    If you are using Master pages.. then have to make sure that <head runat="server">  is there in the master page.

    regards,

    ukv

  • Re: Must have a <head runat="server"> Error

    03-07-2008, 5:14 AM
    • Member
      5 point Member
    • eryn
    • Member since 12-10-2007, 1:54 AM
    • Posts 10

    I'm spitting out the page via xml, so I can't add the runat="server" at design time, is there some way I can add it in the OnPreInit method maybe??

Page 1 of 1 (10 items)