Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with ScriptManager when trying to email rendered contents of ASP.NET page
    text
    copied!<p>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:</p> <p>The control with ID 'myIdHere' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.</p> <p>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.</p> <p>Here's a code snippet, any ideas as to whether there is a problem with scriptmanager when doing this sort of thing?</p> <pre><code>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(); </code></pre> <p><strong>Update</strong> 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:</p> <pre><code>contentTable |__UserControl1 |__ScriptManager1 |__UserControl2 |__Control "myIdHere", a Telerik RadComboBox requiring a ScriptManager </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload