title: "Error executing child request for handler 'System.Web.UI.Page'." while adding user control using JQuery
body: <p>I am loading ASP.NET user control dynamically using JQuery:</p>
  
  <pre><code>function OnSuccess(response) {
      var xmlDoc = $.parseXML(response.d);
      var xml = $(xmlDoc);
      pageCount = parseInt(xml.find("PageCount").eq(0).find("PageCount").text());
      var topics = xml.find("Topics");
      topics.each(function () {
          var table = $("#dvTopics table").eq(0).clone(true);
  
          var customer = $(this);
          $.ajax({
              type: "POST",
              url: "TopicList.aspx/LoadUserControl",
              data: "{message: '" + topics.find("desid").text() + ",'}",
              contentType: "application/json; charset=utf-8",
              dataType: "json",
              success: function (r) {
                  table.append(r.d);
              }
          });
          $("#dvTopics").append(table).append("&lt;br /&gt;");
  
      });
  
      $("#loader").hide();
  }
  </code></pre>
  
  <p>User Control code:</p>
  
  <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="TopicRow.ascx.cs" Inherits="TopicRow" %&gt;
  &lt;link rel="stylesheet" type="text/css" href="Styles/Global.css" /&gt;
  &lt;asp:Panel ID="Panel1" runat="server" BorderColor="Maroon" Width="600px" style="margin:0"&gt;
  
              &lt;asp:LinkButton ID="Title" runat="server" Font-Bold="True" Font-Names="Segoe UI Semibold,Segoe UI Light, Tahoma, Geneva, Verdana, sans-serif" Font-Overline="False" ForeColor="Maroon" Text="This is a test title." Font-Size="Larger"&gt;&lt;/asp:LinkButton&gt;
  
              &lt;br /&gt;
  
      &lt;asp:Label ID="lblAuthor" runat="server" Text="By: Aishwarya Shiva Pareek" Font-Size="Medium" ForeColor="#666666" Font-Names="Segoe UI Light, Tahoma, Geneva, Verdana, sans-serif"&gt;&lt;/asp:Label&gt;
  
          &lt;br /&gt;
      &lt;br /&gt;
      &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
          &lt;ContentTemplate&gt;&lt;div style="float:right; height:32px; width:32px"&gt;&lt;asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel1"&gt;
              &lt;ProgressTemplate&gt;
                  &lt;img alt="Working..." class="auto-style5" src="Images/ajaxloader.gif" width="32px" height="32px" /&gt;
              &lt;/ProgressTemplate&gt;
          &lt;/asp:UpdateProgress&gt;&lt;/div&gt;
              &lt;div style="font-family:Segoe UI Light, Tahoma, Geneva, Verdana, sans-serif"&gt;
          Upvoted By
          &lt;asp:Label ID="lblUp" runat="server" Text="23"&gt;&lt;/asp:Label&gt;
          &amp;nbsp;| Down voted By
          &lt;asp:Label ID="lblDown" runat="server" Text="2"&gt;&lt;/asp:Label&gt;
              &lt;br /&gt;
              &lt;asp:LinkButton ID="lnkUp" runat="server" ForeColor="#003300" OnClick="lnkSupport_Click"&gt;Up Vote&lt;/asp:LinkButton&gt;
              &amp;nbsp;
              &lt;asp:LinkButton ID="lnkDown" runat="server" ForeColor="Red"&gt;Down Vote&lt;/asp:LinkButton&gt;
              &amp;nbsp;
              &lt;asp:LinkButton ID="lnkAddComment" runat="server" ForeColor="Maroon"&gt;Add Comment&lt;/asp:LinkButton&gt;&lt;/div&gt;
          &lt;/ContentTemplate&gt;
      &lt;/asp:UpdatePanel&gt;
      &lt;hr style="color:maroon;"/&gt;
  &lt;/asp:Panel&gt;
  </code></pre>
  
  <p>C# Code to add user control:</p>
  
  <pre><code>public static string LoadUserControl(string message)
      {
          using (Page page = new Page())
          {
              UserControl userControl = (UserControl)page.LoadControl("TopicRow.ascx");
              (userControl.FindControl("Title") as LinkButton).Text = message;
              page.Controls.Add(userControl);
              using (StringWriter writer = new StringWriter())
              {
                  page.Controls.Add(userControl);
                  HttpContext.Current.Server.Execute(page, writer, false);
                  return writer.ToString();
              }
          }
      }
  </code></pre>
  
  <p>But at line <code>HttpContext.Current.Server.Execute(page, writer, false);</code> its showing:<code>Error executing child request for handler 'System.Web.UI.Page'.</code>exception. What can be the reason?</p>