ASP Web Form Quick Start for. NET
Form Verification Control
The Web Forms page architecture of ASP. NET provides a set of server control verification methods, which are easy to use and powerful. They can check the correctness of the form input content and display the corresponding feedback information.
The verification control can be added to the ASP. NET page like other server controls. There are some verification controls that process special types, such as range check or matching judgment plus a RequiredFieldValidator control, so that users do not skip the operation of an input field.
The following example describes how to use two <asp: requirefieldvalidator runat = server> controls to verify the content of the TextBox and DropDownList controls on the page:
Intro10.aspx
Click execute to view the source code
The code here also applies to browsers of high and low versions. For high-version browsers, Javascript and DHTML will be used on the client side for verification. For earlier browsers, verification is performed on the server.
ASP. NET Page developers can check the value of the Page. IsVaild attribute at runtime to determine whether all the verification server controls on the Page are currently valid. This provides a simple "single line" processing method for determining whether to execute the business logic. For example, in the following example, check the value of Page. IsValid before searching the database in the selected directory:
Intro11.aspx
Click execute to view the source code
Code-Behind Web Forms
ASP. NET supports two methods for creating dynamic pages. The first is the definition in the original. aspx file. Another method is Code-behind, which can be used to make the Page Code more clearly separated from its content.
See the following demo:
Intro12.aspx
Click execute to view the source code
Knot
Through the above graphic examples, I think you must have experienced the powerful functions of ASP. NET. In the past, many complicated technical details that need to be processed in ASP are completely ignored in ASP. NET, and their functions are greatly enhanced. New technologies only attract us. The key is that they allow us to focus more on content ideas rather than technical details, so as to give full play to our imagination and creativity.