Knowledge about ASP. NET page events and asp.net event knowledge points
ASP is the abbreviation of Dynamic Server Page (ActiveServerPage). It is an application developed by Microsoft to replace CGI script programs. It can interact with databases and other programs, it is a simple and convenient programming tool. So how much do you know about ASP. NET page events?
You can see that in ASP. NET (ASP. NET is. part of NETFrameWork is a Microsoft technology and a server-side scripting technology that allows scripts embedded in web pages to be executed by Internet servers .) In the life cycle of a Page, the object named Page will publish some frequently used standard events. When the ASP. NET page framework is running, it will automatically connect to the corresponding proxy instances of these methods. In this way, you do not need to write some necessary "bonding code ". Here, the editor will list a list for you. In this list, we can see that this is a connection proxy instance provided for running in the order of excitation. The specific list is as follows:
1. Page_DataBind: When the DataBind method is called at the page level, the DataBind event is triggered. If we call DataBind on a single control, it will only stimulate the DataBind event of the control below it.
2. Page_PreRender: The PreRender event is triggered just before the control is rendered and the view State is saved. Then you can use this event to perform all the operations at the last moment on the control.
3. Page_Load: When this event occurs, you can perform a series of operations. What are the specific operations? Yes, it is the first time to create an ASP. NET page or respond to a client caused by delivery (a client or a client is a program that corresponds to a server and provides local services to the customer .) Event. The control view and page status have been restored before this event. Now we need to check whether this page is processed for the first time. We only need to use the IsPostBack page attribute to check the page. If this is the first time, please perform data binding. In addition, please update and read control properties.
4. Page_Unload: After the page is displayed, you will find that the Page_Unload event is triggered. This event is exactly the right place for the final cleanup. Of course, this includes cleaning up opened database connections, closing opened files, or discarding objects.
5. Page_Init: When this event occurs, you can connect any possible event or initialization value to process the referenced program.
In addition, the editor will also list another list, which includes three events. The main content is to summarize events that are not deterministic. The specific list is as follows:
1. Page_AbortTransaction: if we want to specify whether a transaction is successful or failed, the transaction event is very important at this time. Everyone should know that this event is often used in the shopping cart solution. This event can also indicate whether the order is failed or successful. If the transaction has been terminated, the system will automatically trigger this event.
2. Page_CommitTransaction: if the transaction has been successfully submitted, this event will be triggered.
3. Page_Error: if there are some exceptions that are not handled during page processing, an Error event is triggered. We also need to know that error events can provide you with the opportunity to properly handle errors. Therefore, you must pay more attention and do not miss the opportunity.