Taste ASP. NET (3)

Source: Internet
Author: User

Page events

Previously, I mentioned that ASP. NET has been rewritten from scratch, but I did not point out that it was rebuilt based on the object-oriented approach. At the top of the Object Tree is a Page object, that is, a Page object, ASP. NET, each control, application, and page are inherited from this object, that is, each page is an example of a page object. The page Load event is a very important event, as shown in table 3 code below:
Table 3 Use Page events
<Html>
<Script language = "VB" runat = "server">
Sub Page_Load (Source As Object, E As EventArgs)
'Code to run when page loads
End Sub
Sub SubmitButton_Click (Source As Object, E As EventArgs)
'Code to run when button is clicked
End Sub
Sub Page_Unload (Source As Object, E As EventArgs)
'Code to run when page unloads
End Sub
</Script>
<Form runat = "server">
<Asp: Button text = "Enter" OnClick = "SubmitButton_Click" runat = "server"/>
<Asp: label id = "YouEntered"/>
</Form>
</Html>
Here you see the same Load/Unload (Load/Unload) process often seen in Visual Basic. When a page is loaded, the Load event is activated, and all server-based controls are available. Other events are generated during interaction with users. Finally, the Unload event is activated when the page is uninstalled.

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.