Everything SharePoint and XAML

My continuous learning of SharePoint, XAML, Silverlight, Windows Phone 7, Windows 8, Office, VSTO, C#…

Script controls may not be registered before PreRender

Posted by Steve Pietrek on April 11, 2008

I have been working on a few custom Web Controls/Web Parts. One of the controls is a stock quote which updates every 10 minutes (or whatever the user defines). This is done by using an UpdatePanel and Timer. In my custom application.master page, I have the stock quote Web Control. When I attempt to view the People and Groups page in Site Settings (/_layouts/people.aspx?MembershipGroupId=4), I receive the following error.  

Script controls may not be registered before PreRender.   at System.Web.UI.ScriptControlManager.RegisterScriptControl[TScriptControl](TScriptControl scriptControl)
   at System.Web.UI.UpdateProgress.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.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

What’s weird is I can access other pages within _layouts without issues. My thinking is there must be some extra things going on in the people.aspx page which is causing the error. I will review it over the weekend. Anybody else seen this?

Advertisements

11 Responses to “Script controls may not be registered before PreRender”

  1. Chris Georgakopoulos said

    I get it to on the exact situation. Did you find a solution?

  2. Benjamin said

    Got the same issue with a RadTreeView in the application.master. Did you find a solution?

  3. Hi,

    I have the same problem and been trying to fix it for some time,

    This is my current situation:

    I have a custom masterpage with multiple usercontrols, these usercontrols are all ajax enabled. However i wanted to have a general updateprogress control so i placed this seperatly on the masterpage so i wil work for all ajax postbacks.

    This works perfectly for all pages, except for the people and groups page.

    Did you find a solution / workarround?

    Sincerly

  4. Eric Rockenbach said

    We are experiencing the exact same issue. Does anyone have a fix for this item? We have a custom user control that is embedded in application.master. The user control resides in CONTROLTEMPLATES off of 12 which should give it a higher level of CAS then normal user controls placed in the root web.

    Any advice?

  5. Vee said

    Hi Steve,
    Did you ever get around this problem?
    I’m getting the same issue using Telerik’s RadMenus.
    Cheers.
    Vee

  6. Nadir Kamdar said

    Just came across the same error. any luck resolving it?

  7. Girish Uppal said

    i got the same error.

    telerik RAD menu scripts are not getting registered while application.master is being loaded.. any resolutions to it?? thanks in advance.

  8. Hi,

    Although it’s been a year you’ve posted this, others will be benefiting by browing this page to find a solution.

    If you have used “CreateChildControls” method, call “EnsureChildControls();” on “OnInit” event. This will work like a charm.

    protected override void OnInit(EventArgs e)
    {
    base.OnInit(e);
    EnsureChildControls();
    }

    Credit should go to the following link;

    http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/3a597eef-f1ef-4485-99b7-9afb2a161222?prof=required&lc=1033

    Cheers

    • Adam said

      If you have used “CreateChildControls” method, call “EnsureChildControls();” on “OnInit” event. This will work like a charm.

      protected override void OnInit(EventArgs e)
      {
      base.OnInit(e);
      EnsureChildControls();
      }

      You are a live saver, this is exactly the issue.
      !! THANK YOU !!

      • hi said

        hi ,
        i tried above solution to fix my same error in one of my web user control but i still getting same error

    • Paul said

      Thanks!!!!

      This fixed my problem! 😀

Sorry, the comment form is closed at this time.

 
%d bloggers like this: