[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

Does event handling happen before or after the Page_load?

Does event handling happen before or after the Page_load?
0
chuang4630
Asked:
chuang4630
  • 3
  • 2
1 Solution
 
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
 
Jojo1771Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now