Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Load Page aspx at runtime

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Giorgio - 03 Mar 2008 15:24 GMT
Hi,
   I use successfully the Page.LoadControl(string virtualPath) method (with
*.ascx files) and Control.Render(writer) to create template and then
serialize them into a stringWriter to store the result into a file.
I would like to do the same with some pages (file *.aspx), but i cannot find
a way to load the page file as I do with a *.ascx file (Page.LoadControl
method says that Page is not a Control).

Where is the method? How does the asp.net framework engine (of iis or
cassini) to do this job??
I've found System.Web.UI.PageParser.GetCompiledPageInstance method, but it
doesn't load controls, it only creates an instance of the class with
Controls collection empty (so Page.RenderControl() serialize empty string!)

Thank you

Giorgio
bruce barker - 03 Mar 2008 16:30 GMT
you found the correct method.

as your code is  hosting the page, it need to call the page events and
implement the page lifecycle. you need initiial a viewstate, create a session
provider, create a request, form collection. etc. then fire oninit, onload,
prerender, etc.

-- bruce (sqlwork.com)

> Hi,
>     I use successfully the Page.LoadControl(string virtualPath) method (with
[quoted text clipped - 13 lines]
>
> Giorgio

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.