Page methods subscribing to Control Events such as Load and PreRender
-
It makes sense that in the Page class, there are certain methods where the Page subscribes to the above Control class' events, for example:
this.PreRender += new EventHandler(Page_PreRender);
This is because, without the programmer writing this, you declare a method in Page class as follows:
protected void Page\_Load(object sender, EventArgs e) {...} protected void Page\_PreRender(object sender, EventArgs e) {...}
and it automatically is invoked during the Load and PreRender events respectively. How do I determine which methods in Page class the subscription to the events are made? I don't think there is necessarily just 1 method where all the events are subscribed to. The reason I am asking is so that if I needed to subscribe to any of these events in my Page derived custom pages, I can place them properly.
---------------------------------------------------------- Lorem ipsum dolor sit amet.
-
It makes sense that in the Page class, there are certain methods where the Page subscribes to the above Control class' events, for example:
this.PreRender += new EventHandler(Page_PreRender);
This is because, without the programmer writing this, you declare a method in Page class as follows:
protected void Page\_Load(object sender, EventArgs e) {...} protected void Page\_PreRender(object sender, EventArgs e) {...}
and it automatically is invoked during the Load and PreRender events respectively. How do I determine which methods in Page class the subscription to the events are made? I don't think there is necessarily just 1 method where all the events are subscribed to. The reason I am asking is so that if I needed to subscribe to any of these events in my Page derived custom pages, I can place them properly.
---------------------------------------------------------- Lorem ipsum dolor sit amet.
Try to dig down the AutoEventWireup attribute of the page directive and its use....you will be able to understand how the default events gets wired up with the event handler.