The web part lifecycle is described like this:
On Page Load
- Constructor
- OnInit
- OnLoad
- ConnectionConsumer method is called if web part is connectable
- CreateChildControls ...
On 1st Postback (PostBack click handler sets ViewState via public Property)
- Constructor
- OnInit
- CreateChildControls
- OnLoad
- PostBack click handling ...
On 2nd Postback (PostBack click handler sets ViewState via public Property)
- Constructor
- OnInit
- LoadViewState
- CreateChildControls
- OnLoad ...
As you can see the OnLoad and CreateChildControls change their order. This introduces some difficulties in my code as I need to gather various data which I used to do in the OnLoad element.
Is there any reason why the order is changed in the post back phase?