asp.net MVC contact Manager Development Tour Iteration 3

Source: Internet
Author: User

Iteration 3-Validating the form

This is the third iteration of the contact Manager, and in this iteration we will add basic form validation to the Contacts manager. If the user fills out a form that is incomplete, we will block the submission of its form. In addition we have to verify the legality of the phone number and email address. (Figure 1)

Figure 1

In this iteration, we write the validation logic directly in the controller action, but this is not the approach recommended by the ASP.net MVC application. A better approach would be to deploy these validation logic to another service layer. In the next iteration we will refactor the contact Manager application to make it easier to maintain.

To make this article look intuitive, we'll write all the validation code in this iteration. Of course, we can also use some out-of-the-box validation frameworks to automate the generation of these validation codes. For example, you can use the Microsoft Enterprise Library Validation Application Block (VAB) to implement the validation logic for ASP.net mvc. For more information on VAB, please see the link below:

Http://msdn.microsoft.com/en-us/library/dd203099.aspx

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.