Home > Backend Development > C#.Net Tutorial > Two things to note in ASP.NET programs

Two things to note in ASP.NET programs

怪我咯
Release: 2017-04-01 11:27:29
Original
1459 people have browsed it

Reading Tips: This article gives two things to pay attention to about the Page_Load event of the ASPX page in ASP.NET: 1. Sometimes the Page_Load event in your ASP. NET page; 2. Sometimes it seems that the click event processing code of a button does not run. and how to handle these situations.

There are two strange things about the Page_Load event of the ASPX page in ASP.NET. You should remember them:

a. Sometimes the Page_Load event in your ASP.NET page Will happen multiple times. One possible reason why this happens is that you set the AutoEvenWireup value of the ASPX page to True. If this is the case, then it is not necessary to add the line "Handles MyBase.Load" after "Sub Page_Load(ByVal Sender as System.Object,ByVal e as System.EventArgs". Since Visual Studio.NET can automatically When you handle this part, you can of course set the AutoEventWireup value to False.

b. Sometimes it seems that the click event handling code of a button is not running. Here you should check the Page_Load event to ensure that any data is loaded. A simple way to check this is that code (such as the code that binds data in the dropdown) is only run when the page is initially loaded, not later when the client data is returned. Just add a test for the Page.IsPostBack value in your Page_load event handling function - False means that this is the first time the page has been loaded and True means that a data return process has occurred ##. #

The above is the detailed content of Two things to note in ASP.NET programs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template