Render Control Without Page
<p>I am currently working with an internal framework. It's all great, but the framework doesn't use aspx pages, it renders pages using Response.Write. The issue I am having is that I need to use a rad control on the page, so all I need to do is generate the rad control to get the HTML code so I can dump it onto the page. Is this possible? I've tried creating a Page object to get it working, but it doesn't work. It seems that when a page is called, it's doing some other initializing. I also tried casting the HttpContext.Current.Handler to a page, but that didn't work because they are using another class, not System.Web.UI.Page to handle requests.</p>

<p>At this point I'm not too sure what else to try. If I can mimc the Page creation class, that would be wonderful. Does anyone know the exact steps to create and initialize a Page object properly?</p>

<p>Hopefully this makes sense... if not, I'll try to make it more understandable.</p>

<p>Thanks!</p>

<h2>Update</h2>

<p>Just wanted to give you the code that I am playing with. Hopefully this will show you what I am trying to do:</p>

<p>this is working:</p>

<pre><code>HtmlForm f = new HtmlForm();
            RadEditor re = new RadEditor();
            f.ID = "form1";


            this.Page.Controls.Add(f);

            re.ID = "rdControl";

            StringBuilder sb = new StringBuilder();
            StringWriter tw = new StringWriter(sb);
            HtmlTextWriter hw = new HtmlTextWriter(tw);

            //Page p = new Page();//(Page)HttpContext.Current.Handler;

            //HtmlForm f = new HtmlForm();

            //p.Controls.Add(f);

            f.Controls.Add(re);
</code></pre>

<p>This is not working:</p>

<pre><code>HtmlForm f = new HtmlForm();
            RadEditor re = new RadEditor();
            f.ID = "form1";
Page p = new Page();

            p.Controls.Add(f);

            re.ID = "rdControl";

            StringBuilder sb = new StringBuilder();
            StringWriter tw = new StringWriter(sb);
            HtmlTextWriter hw = new HtmlTextWriter(tw);

            //Page p = new Page();//(Page)HttpContext.Current.Handler;

            //HtmlForm f = new HtmlForm();

            //p.Controls.Add(f);

            f.Controls.Add(re);
</code></pre>

<p>ideally I'd like to get the second one working to some degree so I can generate the code. Sorry about the mess. It was my test code.</p>

<h2>Update</h2>

<p>So I thought about it, and I think I know where the issue is. The control is trying to access a bunch of files that are not included within the dll, like language files, styles, js files, etc. I think the issue might be that when I create a new instance of Page, it doesn't know where that page is in reference to all the resources. Is there a way i can set the page to a "virtual" URL? Right now I am playing with this code:</p>

<pre><code>HttpContext context = new HttpContext(new HttpRequest(string.Empty, "http://localhost:2090/default.aspx", string.Empty), new HttpResponse(null));
</code></pre>
