Script controls may not be registered after PreRender

2 posts, 0 answers
  1. Ben Brooks
    Ben Brooks avatar
    6 posts
    Member since:
    Dec 2009

    Posted 29 Jun 2010 Link to this post

    Hello Telerik Team,

    I am coming across the following error (Script controls may not be registered after PreRender) when I am trying to create a new tab to load the previous tab User controls into it.
    When I call the Addtab() method, it loads the tab but on PageView created after loading all the child controls, I get this following error.
    I am using xmlDom to load all UserControls.
    Each Tab has a parent UserControl into which I am loading multiple child Controls.

    After Iterating through the xmlnodelist, I finally say:
    parent is the MainParent.ascx, LeftZone is the placeholder into which I need to add teh CustomControl (child.ascx)
    When I get into this step, it executes child.ascx perfectly and when i comes out and tries to stepout of this step, I get this error.
    I have followed few ref, which include: this and this and this.
    Any help regading this issue will be greatly appreciated.


  2. T. Tsonev
    T. Tsonev avatar
    2834 posts

    Posted 02 Jul 2010 Link to this post

    Hi Ben,

    As the error suggests, MS Ajax controls ("script controls") can be added to the control tree only before the PreRender stage of the page life-cycle.

    It should be possible to change your code to instantiate and place the controls in the Controls collection earlier. The OnLoad event (Page_Load) is the most suitable, but earlier stages will also work - OnInit for example.

    I hope this helps.

    Tsvetomir Tsonev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top