1
Vote

Getting the Error : Script controls may not be registered before PreRender

description

After deploying webpart its showing the below error.
 
Script controls may not be registered before PreRender. at System.Web.UI.ScriptControlManager.RegisterScriptControl[TScriptControl](TScriptControl scriptControl)
at System.Web.UI.Timer.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.WebControls.WebParts.WebPart.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

comments

TowneFG wrote Nov 10, 2009 at 7:42 PM

I am getting this error As well.

I am writing cutom web parts and have two that work fine. So I thought I knew what I was doing.

The first two use Web Services and SqlDataObjects to get their data.

The one that is broken uses ObjectDataSource. Not sure that makes any difference.

I am using AJAX under ASP.NET 2.0.

The stack trace makes it appear to be the UpdateProgress.OnPreRender that is having the issue.


[InvalidOperationException: Script controls may not be registered before PreRender.]
System.Web.UI.ScriptControlManager.RegisterScriptControl(TScriptControl scriptControl) +271568
System.Web.UI.ScriptManager.RegisterScriptControl(TScriptControl scriptControl) +81
System.Web.UI.UpdateProgress.OnPreRender(EventArgs e) +49

wrote Feb 2, 2013 at 6:10 AM