I recently added a Telerik control to an ascx that is included in an aspx page. This page has a "Send email" button, which when clicked will email the user the rendered output of the page. The Telerik control I added requires a ScriptManager, so I added that to the ascx. However, now the email button won't work. I get the following error:
The control with ID 'myIdHere' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
I know the script manager exists because the page works fine when I go that url, it is only failing when it tries to email the rendered output.
Here's a code snippet, any ideas as to whether there is a problem with scriptmanager when doing this sort of thing?
Page EmailPage = new EmailBasePage();
System.Web.UI.HtmlControls.HtmlForm EmailForm = new System.Web.UI.HtmlControls.HtmlForm();
EmailPage.Controls.Add(EmailForm);
EmailForm.Controls.Add(contentTable); //this is the container with all the controls I want to email
StringBuilder SB = new StringBuilder();
StringWriter html = new StringWriter(SB);
HtmlTextWriter mhtmlWriter = new HtmlTextWriter(html);
EmailPage.DesignerInitialize();
EmailPage.RenderControl(mhtmlWriter);
mhtmlWriter.Close();
Update The control "myIdHere" referenced in the error message is the Telerik RadComboBox control that requires a ScriptManager. It is a child control of the contentTable control that is added to EmailForm. The control hierarchy is like this:
contentTable
|__UserControl1
|__ScriptManager1
|__UserControl2
|__Control "myIdHere", a Telerik RadComboBox requiring a ScriptManager