Reading tip: This article gives two things to note about the Page_Load event of an ASPX page in ASP. 1. Sometimes the Page_Load event occurs multiple times on your ASP. 2. Sometimes it seems that the Click event handling code of a button is not running. And the way in which these situations arise.
The Page_Load event in an ASPX page in ASP. Two is a strange place to remember:
A. Sometimes the Page_Load event occurs multiple times on your ASP. One possible reason for this situation is that you set the Autoevenwireup value of the ASPX page to True. If so, it is not necessary to add "Handles mybase.load" after "Sub Page_Load (ByVal Sender as System.object,byval e as System.EventArgs"). Now that Visual Studio.NET can automatically handle this part for you, you can of course set the AutoEventWireup value to False.
B. Sometimes it seems as if a button's Click event handling code is not running. Here you should check the Page_Load event to ensure that any code that loads data, such as code that binds data in a drop-down list, runs only when the page is initially loaded, rather than when the client data is later returned. An easy way to check this is to add a test of the Page.IsPostBack value to your Page_Load event handler-false means that this is the first time the page is loaded and true means that the data return process has already occurred.