Two areas that need to be noted in the ASP.

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.