Extender control 'HtmlEditorExtender1' is not a registered extender control
<p>I have a webform on which I have used ajax toolkit's <code>HtmlEditorExtender1</code>. It's working fine. Now I am trying to convert entire webform into pdf using iTextSharp on a button click. But I am getting this error:</p>

<pre><code>Extender control 'HtmlEditorExtender1' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors().
Parameter name: extenderControl
</code></pre>

<p>I believe it has something to do with the <code>HtmlEditorExtender1</code> </p>

<pre><code> &lt;ajaxToolkit:HtmlEditorExtender ID="HtmlEditorExtender1" runat="server" TargetControlID="txtkeyresultforyear" EnableSanitization="false" /&gt;
</code></pre>

<p><strong>The top of my webform looks like this:</strong></p>

<pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/ModuleMain.master" AutoEventWireup="true"
    ValidateRequest="false" CodeBehind="xyz.aspx.cs" EnableEventValidation = "false" Inherits="abc.xyz" %&gt;
&lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %&gt;
</code></pre>

<p><strong>This my code on button click:</strong></p>

<pre><code>protected void btntopdf_Click(object sender, EventArgs e)
{
    Response.ContentType = "application/pdf";
    Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf");
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    StringWriter sw = new StringWriter();
    HtmlTextWriter hw = new HtmlTextWriter(sw);
    this.Page.RenderControl(hw);
    StringReader sr = new StringReader(sw.ToString());
    Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
    HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
    PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
    pdfDoc.Open();
    htmlparser.Parse(sr);
    pdfDoc.Close();
    Response.Write(pdfDoc);
    Response.End();
}
</code></pre>

<p><strong>EDIT:</strong></p>

<p>I am getting this error at :</p>

<pre><code>this.Page.RenderControl(hw);
</code></pre>

<p><a href="https://i.stack.imgur.com/UhxXI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UhxXI.jpg" alt="enter image description here"></a></p>