This is a migrated thread and some comments may be shown as answers.

Script controls may not be registered after PreRender

1 Answer 118 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Ben Brooks
Top achievements
Rank 1
Ben Brooks asked on 29 Jun 2010, 08:23 PM
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:
e.PageView.FindControl(parent).FindControl(LeftZone).controls.add(customControl)
Where
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.

Thanks

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 02 Jul 2010, 12:47 PM
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.

Greetings,
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
Tags
TabStrip
Asked by
Ben Brooks
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or