What happend in Page_init()

Posted by Bravi under ASP.NET on 9/29/2009 | Views : 4927 | Status : [Member] | Replies : 2
In page life cycle what happen exectly on Page_init()

Thanks&Regards,

B Ravi.




Responses

Posted by: Rtpharry on: 9/29/2009 [Member] [MVP] Bronze

Up
0
Down
Whatever code you put in there :)

The pre_init event is fired early on the page life cycle, it is a stage where you can make changes to certain parts of the page before the controls and that are setup. One common example of this is if you wanted to change the masterpage using the code behind. After the pre_init event (in page_load for example) it is not possible to change the masterpage - it has already been setup.

Generally if you are looking for something in the MSDN docs then it will make it clear if you have to put it in pre init.

To get more information about the types of events that are fired each time a page is requested and also the order they are fired in I suggest doing a search for "asp.net page lifecycle" as this is the collective name for the process.

http://www.google.co.uk/search?q=asp.net+page+lifecycle

Bravi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 9/29/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Rtpharry is Correct. This is where you initialize what ever you want. To programmers who are using SQLDatasource Control, you can initialize its Connection String there.



Thank you for posting at Dotnetfunda
[Administrator]

Bravi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response