473,396 Members | 1,676 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,396 software developers and data experts.

Yikes! Where is that initialization code in ASPNET 2.0?

I am just starting 2.0, so I have this
In ASPNET 1.X there is a method called InitializeComponent() which
clearly wires in the Page_Load method to the Load event, like this:

private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}

(1)
However, in ASPNET 2.0, you will not see this anymore. How am I suppose
to know the Page_Load is the correct method? Do you know where they
are hiding the code?
(2)
You can put the Page_Load method, and it is guaranteed to be called.
However, I noticed that even if I put the wrong signature such as:

void Page_Load()
It is still called anyway. Why is that?

(Note: Load event has this signature: void Load(object,
System.EventArgs )
ASPNET 2.0 gurus please clarify!

Thanks

Nov 19 '05 #1
2 1289
(2)
doesn't the specific load function has the signature "handles Page_Load"
orso tailing behind the function ? (so there's where they make a difference
from the other methods)
"PinoyDotnet" wrote:
I am just starting 2.0, so I have this
In ASPNET 1.X there is a method called InitializeComponent() which
clearly wires in the Page_Load method to the Load event, like this:

private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}

(1)
However, in ASPNET 2.0, you will not see this anymore. How am I suppose
to know the Page_Load is the correct method? Do you know where they
are hiding the code?
(2)
You can put the Page_Load method, and it is guaranteed to be called.
However, I noticed that even if I put the wrong signature such as:

void Page_Load()
It is still called anyway. Why is that?

(Note: Load event has this signature: void Load(object,
System.EventArgs )
ASPNET 2.0 gurus please clarify!

Thanks

Nov 19 '05 #2
> (1)
However, in ASPNET 2.0, you will not see this anymore. How am I
suppose
to know the Page_Load is the correct method? Do you know where they
are hiding the code?
There are several methods that are automatically called based upon naming
convention. This list is well documented. This was the way it was in v1.x
as well. The three important ones are:

Page_PreInit
Page_Init
Page_Load

IIRC, there are about ten in total. With Reflector, go check out the code
for System.Web.UI.TemplateControl.HookUpAutomaticHandl ersWithNoAssert.
(2)
You can put the Page_Load method, and it is guaranteed to be called.
However, I noticed that even if I put the wrong signature such as:
void Page_Load()

It is still called anyway. Why is that?


This too was supported in v1.x. It's just a convenience.

-Brock
DevelopMentor
http://staff.develop.com/ballen


Nov 19 '05 #3

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

Similar topics

1
by: scott | last post by:
Anyone else seen a deal in Internet Explorer with an image map where, when the map is clicked on, an outline of the maparea is highlighted? It's kind of odd. If so, please email me at:...
4
by: Garibaldi | last post by:
Folks, I'm having a bad regex day and can sure use your help, please.. I have a Regex expression that works fine. It's purpose is to isolate all data from the start of a string begining with...
4
by: Garibaldi | last post by:
Folks, I'm having a bad regex day and can sure use your help, please.. I have a Regex expression that works fine. It's purpose is to isolate all data from the start of a string begining with...
4
by: Garibaldi | last post by:
Folks, I'm having a bad regex day and can sure use your help, please.. I have a Regex expression that works fine. It's purpose is to isolate all data from the start of a string begining with...
10
by: RobKinney1 | last post by:
Hello everyone... This may sound really stupid, but it is something I have been working on all day and haven't found a solution yet. If you go into Notepad and try the keystroke ALT+4, you get a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.