Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
If I declare a default value for a textbox, and in the preinit event I assign another value for the same textbox, then which value is it that will be displayed?
Posted
Updated 20-Sep-10 3:10am
v2

Try it!!!
How much... 5 min?... 10min max it will take!!!
 
Share this answer
 
Comments
Marc A. Brown 20-Sep-10 12:06pm    
Heh. But what if it causes the destruction of the universe? Won't you feel bad for suggesting they try it then? ;)
Abhishek Sur 20-Sep-10 18:25pm    
@Marc ha ha .. Hope not 2012 comes soon. :)
In PreInit the TextBox is not initialized. So if you write

C#
protected void Page_PreInit(object sender, EventArgs e)
       {
           yourTextBox.Text = "newtext";
       }



It will throw error as yourTextbox is still null.:cool:
 
Share this answer
 
Here is a good explanation of page life cycle for ASP.NET. It will clear your doubts.

http://www.asp.net/general/videos/page-lifecycle-events
 
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