An Idea can change your life.....

Saturday, July 12, 2008

Web Page/Server Control Life Cycle Methods and Events

Method (Event) / Description
1. OnInit (Init)

Initializes each child control of the current


Loads the ControlState of the control. To use this method, the control must call the Page.RegisterRequiresControlState method in the OnInit method of the control.


Loads the ViewState of the control.


Is defined on interface IPostBackDataHandler. Controls that implement this interface use this method to retrieve the incoming form data and update the control’s properties accordingly.

5.Load (OnLoad)

Allows actions that are common to every request to be placed here. Note that the control
is stable at this time; it has been initialized and its state has been reconstructed.


Is defined on the interface IPostBackData-Handler. Controls that implement this interface
use this event to raise change events in response to the Postback data changing between the current Postback and the previous
Postback. For example, if a TextBox has a TextChanged event and AutoPostback is turned off, clicking a button causes the Text-Changed event to execute in this stage before handling the click event of the button, which is raised in the next stage.


Handles the client-side event that caused the Postback to occur.

8.PreRender (OnPreRender)

Allows last-minute changes to the control. This event takes place after all regular Post-back events have taken place. This event takes place before saving ViewState, so any changes made here are saved.


Saves the current control state to ViewState. After this stage, any changes to the control state are lost. To use this method, the control must call the Page.RegisterRequiresControlState method in the OnInit method of the control.


Saves the current data state of the control to ViewState. After this stage, any changes to the control data are lost.


Generates the client-side HTML, Dynamic Hypertext Markup Language (DHTML), and script that are necessary to properly display this control at the browser. In this stage, any changes to the control are not persisted into ViewState.


Accepts cleanup code. Releases any unman-aged resources in this stage. Unmanaged resources are resources that are not handled by the .NET common language runtime, such as file handles and database connections.


Accepts cleanup code. Releases any managed resources in this stage. Managed resources are resources that are handled by the runtime, such as instances of classes created by the .NET common language runtime.

Heaven or Hell

Once an old man was sitting in the park reading book "learn Oracle in 21days".

A passer by saw him and asked "U are such an old guy, why do you bother to learn Oracle?

"I have heard that communication language at heaven is Oracle so after my death when I will be in heaven, I don't want to face communication
problem."old man replied.

"But how come u are so sure that U will be in heaven? It could be a hell also." he asked.

"Ya, doesn't matter .... I already know J2EE"

Fate and the Heart

Kindergarten teacher has decided to let her class play a game. The teacher told each child in the class to bring along a plastic bag containing a few potatoes. Each potato will be given a name of a person that the child hates, so the number of potatoes that a child will put in his/her plastic bag will depend on the number of people he/she hates. So when the day came, every child brought some potatoes with the name of the people he/she hated. Some had 2 potatoes; some 3 while some up to 5 potatoes.

The teacher then told the children to carry with them the potatoes in the plastic bag wherever they go for 1 week.

Days after days passed by, and the children started to complain due to the unpleasant smell let out by the rotten potatoes. Besides, those having 5 potatoes also had to carry heavier bags. After 1 week, the children were relieved because the game had finally ended.

The teacher asked: 'How did you feel while carrying the potatoes with you for 1 week?' The children let out their frustrations and started complaining of the trouble that they had to go through having to carry the heavy and smelly potatoes wherever they go. Then the teacher told them the hidden meaning behind the game.

The teacher said: 'This is exactly the situation when you carry your hatred for somebody inside your heart. The stench of hatred will contaminate your heart and you will carry it with you wherever you go. If you cannot tolerate the smell of rotten potatoes for just 1 week, can you imagine what is it like to have the stench of hatred in your heart for your lifetime???'

Moral of the story:

Throw away any hatred for anyone from your heart so that you will not carry sins for a life time.
Forgiving others is the best attitude to take! Life is to be fortified by many friendships. To love & to be loved is the greatest happiness.

Fate determines who comes into our lives. The heart determines who stays.