ASP Web Form Quick Start for. NET (6)

Source: Internet
Author: User

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.


Related Article

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.