Rendering an instance of an .aspx page

F

foobar

Okay, if I create an instance of an .aspx page and set the properties of
that page, how do I render that instance?
Server.Transfer creates a new instance of its own and none of the properties
have been set.

p.s. I thank you in advance for any relpy.
 
E

Eliyahu Goldin

Are you sure you are on the right track? Normally you would have a page as a
file and set the properties when the page loads.

Eliyahu
 
F

foobar

I have created a class that takes some connection parameters and a crystal
report file name. When initialized the connection data is setup on the
instance. I have added a method whereby Crystal Parameter fields can be
added.
I am trying to create a model whereby I can configure any given report and
render this report in a generic aspx page. I could then set the Report
property on this generic aspx page to that created in the class metioned
above. Set whether I want to preview in browser or export to file and then
render the aspx page.
I could be going about this all wrong. Please advise.
 
M

Matt Berther

Hello foobar,

Use the RenderControl method of the Page and pass in an HtmlTextWriter.

StringBuilder sb = new StringBuilder();
using (StringWriter sw = new StringWriter(sb))
using (Html32TextWriter writer = new Html32TextxWriter(sw))
{
myPageVariable.RenderControl(writer);
}

// at this point, sb.ToString() has the rendered instance of the Page
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top