Hey folks.
For you guys struggling with one of the following errors (or both if you try to render a new ScriptManager)
- Only one instance of a ScriptManager can be added to the page.
- The control with ID 'xx' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
The solution is to make sure that the ScriptManager is rendered BEFORE the given RAD Control, and that only one ScriptManager exists. The following code snippet should achive this:
protected override void CreateChildControls()
{
if (ScriptManager.GetCurrent(this.Page) != null)
{
this.sm = ScriptManager.GetCurrent(this.Page);
}
else
{
this.sm = new ScriptManager();
this.Controls.Add(this.sm);
}
}
Now make sure the ScriptManager is rendered BEFORE the controls needing it (ie RadEditor)
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
this.sm.RenderControl(writer);
this.radEditor.RenderControl(writer);
}
Hopefully this will be helpful to someone else.