472,990 Members | 3,225 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Init Event on tha Page

Hi folks,

I've got a question regarding the managment of the events in a
System.Web.UI.Page.
If I want to write code for this event in my code behind I have to
write something like that:
protected void Page_Init(object sender, EventArgs e)

That works but I don't understand why!!!

How the .Net framework understand that this is the handler of the event
Init?!?!?
For all the others controls I must use the properties windows to set
the right event handler, but I can't do it with the page...
I'm a little confused, someone can help me?
Best
--
Andrea Rosa

Dec 20 '06 #1
2 1616
Hi Andrea,
I've got a question regarding the managment of the events in a
System.Web.UI.Page.
If I want to write code for this event in my code behind I have to
write something like that:
protected void Page_Init(object sender, EventArgs e)

That works but I don't understand why!!!

How the .Net framework understand that this is the handler of the event
Init?!?!?
The event handler is hooked-up automatically by ASP.NET since it uses a
particular naming convention. The AutoEventWireup attribute of the @Page
directive controls this behavior:

ASP.NET Web Server Control Event Model
§ Binding Page Events
http://msdn2.microsoft.com/en-us/lib...h3(VS.80).aspx
For all the others controls I must use the properties windows to set
the right event handler, but I can't do it with the page...
I'm a little confused, someone can help me?
IIRC you can do that with Pages as well. In the Properties Window select
the Page from the drop-down list at the top. You might not be able to focus
the Page by clicking in the designer, however.

--
Dave Sexton
Dec 20 '06 #2
Hi Dave,

Thanks for your reply,

now It's clear how the implicit binding for page events works.
The event handler is hooked-up automatically by ASP.NET since it uses a
particular naming convention. The AutoEventWireup attribute of the @Page
directive controls this behavior:

ASP.NET Web Server Control Event Model
§ Binding Page Events
http://msdn2.microsoft.com/en-us/lib...h3(VS.80).aspx
IIRC you can do that with Pages as well. In the Properties Window select
the Page from the drop-down list at the top. You might not be able to focus
the Page by clicking in the designer, however.
I haven't found it ...but that's not important.
--
Andrea
--
Dave Sexton
Dec 21 '06 #3

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

Similar topics

4
by: Anatoly | last post by:
Put any control on web page. create Init event for ths control. Write Response.Write("here") inside this event. Compile\build\run. I never saw "here" string appear on web page. Why???
9
by: J.Marsch | last post by:
I must be missing something here: The Init event for controls does not seem to fire. What I did: Drop a textbox on a blank webform, hook the textbox's Init event. Code: this.Textbox1.Value =...
2
by: Hei | last post by:
Hi, i use txtStartTime.Text = Now txtEndTime.Text = Now.AddHours(1) in "page load" event to provoid init value for user in aspx page, user will change it. after user change the time and i...
10
by: Wylbur via DotNetMonster.com | last post by:
Hello to all of you geniuses, I'm having a problem trying to get an Init handler to fire for a Placeholder control at the initialization phase. I’ve posted this problem to 3 other ASP.NET...
6
by: Shimon Sim | last post by:
I have Panel control on the page. I am handling Init event for it. It doesn't seem to fire at all. Why? Thank you Shimon.
0
by: daniel.rolfe | last post by:
Hi All, I have a problem on some production servers where a particular page will postback and then never return. Eventually, the page will time out with a HttpException "Request Timed Out"...
9
by: Alexander van Doormalen | last post by:
I have a situation that user controls are dynamically loaded within a page. To know which control to 're-add' to the page I saved the control path in the ViewState. This Control is added using...
0
by: Kevin Jackson | last post by:
Is there any way to get a shot to hook into server controls on the page Init event. The following code doesn't work because it the page controls must of already had their Init event called. ...
4
by: SandyIsCool | last post by:
Hi, I am newbie to asp.net. I have small doubt regarding page life cycle. MSDN documentaion says that init event does blhah, blah load event does blah blah etc. But Id ont see any init or load...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.