RenderControl in HtmlTextWriter - InvalidOperationException
<p>I would like to render a Control object which is just created on the fly when the user send a postback request. To do so, I use the code below:</p>

<pre><code>StringBuilder sb = new StringBuilder();
HtmlTextWriter ht = new HtmlTextWriter(new StringWriter(sb));
Rating r = new Rating("r", 5, 3, No, Big);
r.RenderControl(ht);
</code></pre>

<p>which unfortunately yields to an <code>InvalidOperationException</code> at the last line and with the following error: </p>

<blockquote>
  <p>The page can not be null. Make sure that this operation is performed in the context of an ASP.NET request.</p>
</blockquote>

<p>I probably misunderstood the way I should use this <code>RenderControl</code> method, and I hope you can help me with my problem. </p>

<p>Thank you,
David</p>
