Monday, March 26, 2012

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

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

As designed, you need that runat attribute.
I got this too (which is easily fixed by making the head runat="server") but is this a requirement on any page using Atlas?

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.


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?


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.


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<headid="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


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).


Hi,

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

regards,

ukv

No comments:

Post a Comment