Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Loading Page Variables

How do you go about loading a page into an object in the C# code?

For Example:

Let's say I have a Base Page Object

class BasePage : Page {

public int ContentID
{
get
{ return (int)Request.QueryString["cID"] }
}

}

Then our page extends BasePage and loads data from a database. We can view the page through the browser and it loads fine. We can also access that loaded page and write it to HTML like this:

BasePage myPage = (BasePage)this.Page;

myPage.RenderControl(htmlW);

When the user requests a page through the browser it loads and gets the data where you can use it like above. HOW CAN THIS BE DONE WITHOUT THE BROWSER REQUEST?

For example: HOW CAN WE...

BasePage NewsContentPage = new BasePage( ContentID );

How do I start the loading process?

Then our page extends BasePage and loads data from a database. We can view the page through the browser and it loads fine. We can also accesss that loaded page and write it to HTML like this:

BasePage myPage = (BasePage)this.Page;

myPage.RenderControl(htmlW);

When the user requests a page through the browser it loads and gets the data where you can use it like above. HOW CAN THIS BE DONE WITHOUT THE BROWSER REQUEST?

For example: HOW CAN WE...

BasePage NewsContentPage = new BasePage( ContentID );

How do I start the loading process?
[1528 byte] By [hoyaabanks] at [2007-11-11 10:28:32]