Reputation: 421
From the code on one page I want to be able to generate an instance of another page and parse the html from certain controls on that page.
this is what i have tried so far
var APIListPage = (APIList)BuildManager.CreateInstanceFromVirtualPath("~/APIHelp/APIList.aspx", typeof(APIList));
ParseHtml(APIListPage.pdfPage);
The problem is APIListPage.pdfPage
is always null
.
Upvotes: 5
Views: 1146
Reputation: 2477
You must call the page instance's "ProcessRequest" procedure, to let it experience a full Page LifeCycle. It won't load just by creating the instance.
Upvotes: 2