title: Microsoft ReportViewer Web Control Requiring a ScriptManager
body: <p>I'm trying to render the report viewer programmatically within a custom Page placed in an IHttpHandler context</p>
  
  <pre><code>ReportViewer rv = new ReportViewer();
  ReportDataSource rds = new ReportDataSource();
  rds.Name = "Report";
  rv.LocalReport.ReportPath = "Report.rdlc";
  
  rds.Value = SomeReportObject;
  
  rv.LocalReport.DataSources.Add(rds);
  rv.LocalReport.Refresh();
  
  ScriptManager scriptHandler = new ScriptManager();
  MyPage p = new MyPage();
  p.Controls.Add(scriptHandler);
  p.Controls.Add(rv);
  
  using (TextWriter myTextWriter = new StringWriter())
          {
              using (HtmlTextWriter myWriter = new HtmlTextWriter(myTextWriter))
              {
                 p.RenderControl(myWriter);
              }
          }
  </code></pre>
  
  <p>Although I have the ScriptManager added to the page but the runtime complains that the ReportViewer needs one, it throws the following exception at p.RenderControl(myWriter) line</p>
  
  <p><strong>The Report Viewer Web Control requires a System.Web.UI.ScriptManager on the web form.</strong></p>
  
  <p>And this is the MyPage Class</p>
  
  <pre><code>public class MyPage : Page
  {
  
      public override void VerifyRenderingInServerForm(Control control)
      {
          //Empty Method
      }
  
      public override bool EnableEventValidation
      {
          get { return false; }
          set { /* Do nothing */}
      }
  }
  </code></pre>
  
  <p>Any help would be very appreciated. This is done on .NET 4 and I'm using ReportViewer 2010.</p>