Click here to Skip to main content
15,888,315 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Can Someone Explain about the difference between the preinit() and init() method of one asp.net web app.

A proper example is mostly appreciated...please
Posted
Comments
Monjurul Habib 27-Jul-11 18:39pm    
though it is basic but still good question.

Preinit is called before the init event, init is called during. Personally I think it's become far too granular, but if your code is complex and across many controls, it helps to control the order of operations.
 
Share this answer
 
Comments
walterhevedeich 27-Jul-11 22:34pm    
As usual, short and simple, but informative.
Have a look at below links to understand Asp.Net Page Life Cycle Events.

http://msdn.microsoft.com/en-us/library/ms178472.aspx[^]

http://wiki.asp.net/page.aspx/1512/aspnet-page-life-cycle-events/[^]
 
Share this answer
 
Comments
walterhevedeich 27-Jul-11 22:33pm    
Nice links.
RaisKazi 28-Jul-11 0:37am    
Thank you.
The following link will make you clear regarding your question.

http://www.asp.net/general/videos/page-lifecycle-events[^]
 
Share this answer
 
Comments
walterhevedeich 27-Jul-11 22:33pm    
Good link.
Monjurul Habib 28-Jul-11 3:39am    
thank you.
PreInit()

1. Master pages can be called dynamically
2. Themes can be set dynamically
3. Programatically add controls to controls collection

Init()

In this event, we can read the controls properties (set at design time). We cannot read control values changed by the user because that changed value will get loaded after LoadPostData() event fires.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900