Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Rendering an instance of an .aspx page

 
Thread Tools Search this Thread
Old 01-18-2005, 03:50 PM   #1
Default Rendering an instance of an .aspx page


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.




foobar
  Reply With Quote
Old 01-18-2005, 04:04 PM   #2
Eliyahu Goldin
 
Posts: n/a
Default Re: Rendering an instance of an .aspx page
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

"foobar" <> wrote in message
news:%23J3ONUX$...
> 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.
>
>





Eliyahu Goldin
  Reply With Quote
Old 01-18-2005, 04:32 PM   #3
foobar
 
Posts: n/a
Default Re: Rendering an instance of an .aspx page
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.

"Eliyahu Goldin" <> wrote in message
news:%23cbcRcX$...
> 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
>
> "foobar" <> wrote in message
> news:%23J3ONUX$...
> > 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.
> >
> >

>
>





foobar
  Reply With Quote
Old 01-18-2005, 06:37 PM   #4
Matt Berther
 
Posts: n/a
Default Re: Rendering an instance of an .aspx page
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

--
Matt Berther
http://www.mattberther.com

> 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.
>





Matt Berther
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
sessions in .aspx getting mixed up. jet vedi Software 0 07-23-2009 07:25 PM
Load .aspx page on another frame from TreeView Event Sangeeth Software 0 06-25-2009 09:20 AM
.aspx page apears minimized when pops up sam.dev Software 3 02-04-2008 03:04 PM
master page & app_theme folder doesn't work dummies2 General Help Related Topics 0 09-04-2007 05:41 PM
Clear the Session value on page unload tessythampan Software 1 08-12-2006 12:18 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46