views:

154

answers:

1

HI,

I am trying to develop a form which has some user controls , which are basically dropdownlists which will be loaded with static list of pick-list values, and a master page. I have written code in the page behind to bind values to the non pick-list fields.

I find that the flow of the control is like this at runtime :-

1) First the code behind of the page runs , binding data to the controls 2) The master page code runs 3) The user control code behind is run , binding the pick-list values to the Drop down lists.

I would have thought the flow should normally have been 3, 2 and 1.

Can anyone explain this ?

A: 

It depends on which event you're tracking. For instance Init will fire in the page before the others. Then Load fires on the page, then recursively does the same for each control on the page. After Load, the page will continue to fire more events, etc.

Here's a page from Microsoft which describes the page life cycle pretty well.

Ian Suttle
Yes but the question is why is it running the code behind of the main page, then the master page and then the code behind of the user controls in that order ?
Chakra
The documentation says that's what you should expect. Maybe I'm not understanding your question right?
Ian Suttle