Hello Sir...
I am working in asp.net technology and face a problem in asp.net life cycle. I have a one master page and inside master page one web page when we execute this page the life cycle event are execute . Please define who's event are firstly loaded like preinit, init , pageload , page preload?
Abhishek KumarPosted May 30, 2014, 5:47 AM
Below is list of event fired in sequence when a master page with content is merged in page life cycle.
- Content page PreInit event.
- Master page controls Init event.
- Content controls Init event.
- Master page Init event.
- Content page Init event.
- Content page Load event.
- Master page Load event.
- Master page controls Load event.
- Content page controls Load event.
- Content page PreRender event.
- Master page PreRender event.
- Master page controls PreRender event.
- Content page controls PreRender event.
- Master page controls Unload event.
- Content page controls Unload event.
- Master page Unload event.
- Content page Unload event.
Hope this will help.Abhishek
Abhishek KumarPosted Jun 2, 2014, 9:05 AM
Explaining Content page PreInit event below
Page->master page -> HTMLform->Contentpage->Controls
All of this work occurs after the content page's PreInit event, but before the content page's Init event. During this the master page is deserving of its name. The master page is in control - giving orders and rearranging controls. However, by the time the Init event fires the master page becomes just another child control inside the page. In fact, the MasterPage class derives from the UserControl class.
The Pre_Init event we just mentioned is a key event to examine if we want to change the master page file programmatically. By using the @ Page directive and the web.config to specify master page files for our web forms, but sometimes we want to set the master page programmatically. A page's MasterPageFile property sets the master page for the content page to use. If we try to set this property from the Load event, we will create an exception. In other words, the following code
protected void Page_Load(object sender, EventArgs e)
{
MasterPageFile = "~/MyMaster";
}
Hope I am making sense and this will help.
Davin MartynPosted Jun 2, 2014, 6:36 AM
I can't understand please define again how to execute first?