Find articles on computer software, programming, ASP.net, Sql server, databases, C#, websites, Internet, Windows, Outlook macros.
When controls are initialized on an asp.net page, the Page object may not be available. You get an error message that says: Object reference not set.
After initialization, during the Load phase, the Page object is available.
What if you need the Page object during the initialization phase, such as in the CreateChildControls method?
Derive a class from the Page class. During the PreInit event, save a reference to the Page object in HttpContext.Current.Items.
You can then retrieve the reference whenever you need it, even during initialization of controls.
public static string http_context_page = "web_page"; HttpContext.Current.Items.Add(http_context_page, this); // Save Page page = (Page)HttpContext.Current.Items[http_context_webpage]; // Retrieve
Name (required)
Email (required)
Website
Notify me of followup comments via e-mail
AWeber Email List Marketing Test Drive
Use email marketing to convert targeted subscribers to customers. Let the system sell itself for you!
MAKE YOUR PC SUPER FAST Discover 5 Shockingly Simple Techniques That Will Make Any Old Computer Run At Top Speed.
Drive Traffic to Your Website with Article Underground. Increase Your Visitors and Your Profits.
HOW TO HYPNOTIZE ANYONE AT WILL! Amazing Secrets to Hypnotize Anyone, Anywhere, at Any Time for Whatever Reason.