Does event handling happen before or after the Page_load?

Does event handling happen before or after the Page_load?
LVL 1
chuang4630Asked:
Who is Participating?
 
Jojo1771Commented:
0
 
strickddCommented:
A good way to get familiar with the order the code-behind is executed is to set a debug point at every function, including the ones in the web form region. In general, the functions in the web form region are executed to initialize the page. Then the Page_Load function is called. Lastly the event handlers are accesed.

One thing you may need to do is in the Page_Load function put

if not Page.IsPostBack()

end if


around anything you only want executed once per page. This is mostly inclusive of populating form fields. If you do not do this around the population of the form fields, the fields will be reset anytime the page postsback.
0
 
strickddCommented:
Jojo,
    Yeah, i guess you summed it up in one word. I guess I made it more difficult than it had to be by explaining the order of everything that happens...
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
chuang4630Author Commented:
How do I handle the situation where a part of the screen needs to be updated based upon the execution of the particular event handler?
That part of the screen is on the same page but controled by the user control. It produces the HTML script (a list of the hyper-link and plain description) for that portion of the screen.
0
 
strickddCommented:
Is this an AJAX style page? If not, then you can update, change, and remove any section of the page that has the property "runat = server". You just have to be conscious of what code is being executed each time the page posts back.
0
 
chuang4630Author Commented:
That is a user control. I tried it according to your suggestion, but it does not work right.
I am using VS.NET 2005 and SQL 2005. The page inherents from the master page. The user control is placed on the page at master page level.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.