Asp. NET page Events

Source: Internet
Author: User
Asp.net| page

During the life cycle of asp.net pages, the Page object exposes some standard events that are frequently used. The ASP.net page framework is automatically connected to (wired) the appropriate proxy instances of these methods at run time. You don't need to write the necessary "glue code". The following list provides a proxy instance of a run-time connection in the order of excitation:

Page_Init: During this event, you can initialize the value or connect any event handlers that may be present.

Page_Load: During this event, you can perform a series of actions to create a ASP.net page for the first time or to respond to a client event caused by a post. Before this event, the page and control view state were restored. Use the IsPostBack page property to check whether the page is processed for the first time. If this is the first process, perform data binding. Also, read and update control properties.

Page_databind: The DataBind event is raised when the DataBind method is called at the page level. If DataBind is invoked on a single control, it fires only the DataBind event of the control below it.

Page_PreRender: Fires the PreRender event just before the view state is saved and the control is rendered. You can use this event to perform all last-minute operations on the control.

page_unload: The Page_Unload event is fired after the page rendering is complete. This event is the appropriate place to perform the final cleanup effort. This includes actions such as cleaning open database connections, discarding objects, or closing open files.

The following list summarizes non-deterministic events. Page_Error: If an unhandled exception occurs during page processing, the Error event is fired. The error event gives you the opportunity to properly handle the error.

page_aborttransaction: Trading events are useful if you want to indicate whether a transaction is a success or a failure. This event is typically used in the shopping cart scenario, where this event can indicate whether the order was successful or failed. This event is fired if the transaction has been terminated.

Page_committransaction: This event is fired if the transaction was successfully submitted.



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.