ASP. NET event model

Source: Internet
Author: User

ASP uses a linear processing model. Page execution follows the sequence from start to end. Therefore, ASP developers also need to write a lotCode. For example, a web page has three different submit buttons, each of which is submitted to a different page. When you click the button to submit the page, you need to determine in the code which button is triggered, and then perform the correct operation according to the judgment.

The event-driven model used by ASP. NET is not new. It was once unique in Windows programming and development.

The steps for executing ASP. NET events are as follows:

1. The page runs for the first time. ASP. NET creates pages and control objects and executes initialization code. Then, the page is rendered in HTML and returned to the client. At the same time, the page objects are released from the server memory.

2. the user triggers PostBack, such as clicking the button. At this time, all form data on the page is submitted.

3. ASP. NET intercepts the returned page and recreates the page object so that the page remains in the same state as the last client sent back.

4. Next, ASP. NET checks which action triggers PostBack, And then it triggers the corresponding event (for example, button. Click). Your code will respond to this event. In general, you will execute some server operations (such as updating the database or reading data from the file) and then modify the control object to display new information.

5. The modified page is rendered as HTML and then returned to the client. Page objects are released from memory. If another PostBack is triggered, ASP. NET repeats steps 2 to 4.

From Pro ASP. NET 4 in C #2010

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.