473,387 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Page Load order and Constructor

Hi,

I have a problem which I'm sure lots of people must have seen so apologies
if this is well known!
Each of my aspx pages inherits from a base class which contains some
intitalization code for all pages. All ths user cotrols on the page use
these intialised fields however, placing them in the OnInit event of the
base page means they do not get run till last which means the user controls
do not see those initialized fields and so have empty object refrences. To
solve this I put the intialization code into the contructor for the base
page HOWEVER, this blows up the designer in Visual Studio as the
initialization code references objects that are only available at runtime
and when opening up the page in the designer, a horrible object not set to
reference occurs. Is there anyway to have my cake and eat it? Can I
initialize these fields in the base class, have them available in my user
controls but not have the designer blow up?

Any help wil be graetfully received

Cheers

Mike
Nov 18 '05 #1
1 1829
the usual trick is to check if Response is null (indicates you are in
designer mode), but you can also override the OnInit method and initialize
there.

"Mike P" <mi***@plugthenet.com> wrote in message
news:e2**************@TK2MSFTNGP11.phx.gbl...
Hi,

I have a problem which I'm sure lots of people must have seen so apologies
if this is well known!
Each of my aspx pages inherits from a base class which contains some
intitalization code for all pages. All ths user cotrols on the page use
these intialised fields however, placing them in the OnInit event of the
base page means they do not get run till last which means the user controls do not see those initialized fields and so have empty object refrences. To
solve this I put the intialization code into the contructor for the base
page HOWEVER, this blows up the designer in Visual Studio as the
initialization code references objects that are only available at runtime
and when opening up the page in the designer, a horrible object not set to
reference occurs. Is there anyway to have my cake and eat it? Can I
initialize these fields in the base class, have them available in my user
controls but not have the designer blow up?

Any help wil be graetfully received

Cheers

Mike

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: CST | last post by:
Hi All, I have a "Digital Dashboard" that basically has 4 IFrame sections. The page flows in the following order: Messages, Stocks, Weather, User Links. Please note that this order needs to...
1
by: WFB | last post by:
Hi, I have a base class from which all of my pages derive (ABCBasePage). For example, ABCCustomerSelect Inherits ABCPasePage. I would now like to have ABCPocketSelect which should inherit from...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
3
by: Tome73 | last post by:
Could someone give me a comprehensive order of events as they pertain to web controls within a page. The page events are: Page_Init Page_Load Page_PreRender Page_Unload Page_Disposed So...
18
by: J-T | last post by:
Hi All, There is a picture on the following URL which I want to have it in one of my asp.net pages .I mean I want to embed the content of this page in my own page and get its image.Is there a...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
0
by: Managed Code | last post by:
Hello All, Here is my issue and thanks in advance for any assistance. I have a base page with a dropdownlist that fires an event with the selected index. The content page catches the event and...
6
by: Rolandpish | last post by:
Hi there. I'm doing an application in C# 2005. I was used in VB6 to put code in Forms load event in order to initialize some values of the controls (grid values, text boxes values, label captions,...
2
by: slolife | last post by:
See any problem with this code: Here's my Base page class: Public Class BasePage Inherits System.Web.UI.Page Protected m_NeedAlerts As Boolean Private Sub Page_Init(ByVal sender As...
0
by: shaqa | last post by:
I try to do this but i cannot. i creat two layers with actionscript seperated as slideshow need to be,,and i try to put in one rectangle all of my images but cannot put in work,it doesnt load when i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.