title: Get user control html in asp.net
body: <p>i'm trying to load a user control from codebehind service and get it's html value. However there's a repeater in that control that isn't getting loaded/initialized so it's always null</p>
  
  <p>i get</p>
  
  <pre><code>Object reference not set to an instance of an object.
  </code></pre>
  
  <p>within the <strong>loadOrderInvoiceView</strong> function when it tries to</p>
  
  <pre><code>// fill repeater
  this.rptView.DataSource = result;
  this.rptView.DataBind();
  </code></pre>
  
  <p>at the line where it says <strong>this.rptView.DataSource = result;</strong>... i've tried to debug and for some reason <strong>this.rptView</strong> is null</p>
  
  <p>And here's the service call</p>
  
  <pre><code>    StringBuilder sb = new StringBuilder();
      StringWriter tw = new StringWriter(sb);
      HtmlTextWriter hw = new HtmlTextWriter(tw);
  
      //ctrl.RenderControl(hw);
  
      myControls.OrderInvoiceView oiv = new myControls.OrderInvoiceView();
      oiv.loadOrderInvoiceView(OID);// load the control with order id
      oiv.RenderControl(hw);
  
      return sb.ToString();
  </code></pre>
  
  <p>thanks in advance for any ideas. I'm using .net 4</p>