471,610 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,610 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 1562
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Anatoly | last post: by
9 posts views Thread by J.Marsch | last post: by
2 posts views Thread by Hei | last post: by
10 posts views Thread by Wylbur via DotNetMonster.com | last post: by
6 posts views Thread by Shimon Sim | last post: by
reply views Thread by daniel.rolfe | last post: by
9 posts views Thread by Alexander van Doormalen | last post: by
reply views Thread by Kevin Jackson | last post: by
4 posts views Thread by SandyIsCool | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

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.