ASP.NET system.InvalidOperationException: Script controls may not be registered before PreRender.

Today I ran into the following error.

System.InvalidOperationException: Script controls may not be registered before PreRender.

In my case I was overriding OnPreRender and forgot to include base.OnPreRender(e)

  protected override void OnPreRender(EventArgs e) {
      base.OnPreRender(e); //Don't forget me.
    }

Adding in the the call to base solved the issue.

Leave a Reply