ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  ASP.NET
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions
 C Sharp interview questions  C Sharp Interview Questions
 ASP.NET interview questions  ASP.NET Interview Questions
 VB.NET interview questions  VB.NET Interview Questions
 COM+ interview questions  COM+ Interview Questions
 ADO.NET interview questions  ADO.NET Interview Questions
 IIS interview questions  IIS Interview Questions
 MTS interview questions  MTS Interview Questions
 Crystal Reports interview questions  Crystal Reports Interview Questions
 BizTalk interview questions  BizTalk Interview Questions
 Dot Net interview questions  Dot Net Interview Questions
 Exchange Server interview questions  Exchange Server Interview Questions
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions
Question
What is pre-init event in ASP.NET 2.0 page life cycle?
 Question Submitted By :: Kiran
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is pre-init event in ASP.NET 2.0 page life cycle?
Answer
# 1
PreInit()
In this Page level event, all controls created during 
design time are initialized with their default values. For 
e.g., if you have a TextBox control with Text property 
= “Hello”, it would be set by now. We can create dynamic 
controls here. 

This event occurs only for the Page class and 
UserControls/MasterPages do not have this method to 
override. 

Sample code where you can override this method and add your 
custom code:


protected override void OnPreInit(EventArgs e)
        
{
            //custom code            
           base.OnPreInit(e);
 }
Note that PreInit() is the only event where we can set 
themes programmatically. 

Special Case with MasterPages 

It is important to note that Master Page is treated like a 
control in the Content Pages.
So if a Page has a  Master Page associated with it, then 
the controls on the page will not be initialized and would 
be null in this stage. Only after the Init() event starts, 
you can access these controls directly from the page class. 
Why? 

The reason being that all controls placed in the Content 
Page are within a ContentPlaceholder which is a child 
control of a MasterPage. Now Master Page is merged and 
treated like a control in the Content Pages. As I mentioned 
earlier, all events except the Init() and Unload() are 
fired from outermost to the innermost control. So PreInit() 
in the Page is the first event to fire but User Controls or 
MasterPage (which is itself a Usercontrol) do not have any 
PreInit event . Therefore in the Page_PreInit() method, 
neither the MasterPage nor any user control has been 
initialized and only the controls inside the Page class are 
set to their default values. Only after the Page_PreInit() 
event the Init() events of other controls fire up.

 
Is This Answer Correct ?    15 Yes 1 No
Ashutosh Tripathi
 

 
 
 
Other ASP.NET Interview Questions
 
  Question Asked @ Answers
 
For Web services where you can browse on the Internet?  1
I am trying to redirect another site on button click.  7
Types of optimization and name a few and how do u do? Accenture1
1. Briefly describe your ideal job? Swatz-Oils1
what is CLR? PrimeLine3
Is overloading possible in web services? Microsoft1
what is view state? Satyam9
How do you relate an aspx page with its code behind Page? Accenture1
How many view state can be hold by a aspx page ? Intellevate3
Differnce between Control an View State Proteans1
What data types do the RangeValidator control support?  2
What is pre-init event in ASP.NET 2.0 page life cycle? Fulcrum-Logic1
What is the difference between and ActiveX dll and control? Microsoft2
What command line used to generate Runtime callable wrapper. CTS1
What is the purpose of the following segment? If ( !IsPostBack) { sqldataAdapter1.Fill (dsusers1); DataGrid1.DataBind (); } a) To populate the DataAdapter the first time the web page id displayed. b) To populate the DataSet every time the web page is displayed. c) To populate the DataAdapter every time the web page is displayed. d)To populate the DataSet the first time the web page is displayed. Syntax-Softtech2
How do we get only edited/deleted/inserted records from a Dataset? Syntax-Softtech1
What are different ASP.NET Web Forms with the technology different from though ASP (1.0-3.0)?  1
what is soap? Microsoft2
Is it necessary to create a Windows application or Web application to test a Web service ? Is it must to consume this service?  2
what is webpart? what r the parts in this webpart (zone)  1
 
For more ASP.NET Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com