ASP. NET MVC ModelValidation(Five)PrefaceThe previous article mainly explains the Modelvalidatorprovider and modelvalidator two types of custom implementations, but in the MVC framework gives us other ways to do model validation, which is the subject of this article, The model validation using a series of feature types
ASP. NET MVC ModelValidation(two)PrefaceThe previous section demonstrates a simple model validation example, and then mentions in the article where the model validation is located by default in the MVC framework. This article is to solve this problem, and will describe the type of object related to the Modelvalidator t
letter, length between 6~18, can contain only characters, numbers, and underscores.Verify that it contains ^% ",; =?$\" characters: "[^%", "=?$\x22]+".Only Chinese characters can be entered: "^[\u4e00-\u9fa5]{0,}$"Verify email Address: "^\w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *$ ".Verify InternetURL: "^http://([\w-]+\.) +[\w-]+ (/[\w-./?%=]*)? $ ".Verify the phone number: "^ (\ (\d{3,4}-) |\d{3.4}-)? \d{7,8}$" The correct format is: "Xxx-
with Google DHC650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/82/B5/wKiom1deyIXRH6aMAAA64QyvxHc413.png "title=" Qq20160613225136.png "alt=" Wkiom1deyixrh6amaaa64qyvxhc413.png "/>If nothing is passed, it is validated against the validation rules above.650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/82/B4/wKioL1deye_wOztiAAA8hgpHD3A410.png "title=" Qq20160613225255.png "alt=" Wkiol1deye_woztiaaa8hgphd3a410.png "/>If an
By adding the dataannotations of data descriptions to the model classes, we can easily add validation capabilities to the application. DataAnnotations allows us to describe the validation rules that you want to apply on model properties, and ASP. NET MVC will use these dataannotations and then return the appropriate
Original article: http://blog.joycode.com/dotey/archive/2005/01/15/43113.aspx
ASP. NET forums email sending
In forums, email sending is required in many places, such as email registration, password retrieval, and email subscrip
visualized.CKEditor How to use: A, after downloading the website, put the CKEditor package into the project B, add a reference to ckeditor.js in the HTML pageC, add the JS code at the bottom of the HTML page and replace the textarea with the Ckedditor.replace () ckeditorD, the effect is as follows: 6,ckeditor creates a visual editor with JavaScript that defines the actions that each button performs, such as: bold B, adding Let's look at a small example of a JavaScript dynamically generating H
This article is mainly for you to introduce the ASP. NET MVC form validation bubble hint effect of the relevant data, with a certain reference value, interested in small partners can refer to
The example of this article for everyone to share the ASP. NET MVC form
ASP. NET MVC Model validation (ii)PrefaceThe previous section demonstrates a simple model validation example, and then mentions in the article where the model validation is located by default in the MVC framework. This article is to solve this problem, and will describe the
in ASP. Validation controls are as follows:
validation type
The controls used
Description
Mandatory field Validation
RequiredFieldValidator
Make sure that the user does not skip an entry.
Compare validation
C
;usingSystem.Reflection;usingsystem.web;usingSYSTEM.WEB.MVC;usingWebTest.Areas.Validation.Models;namespacewebtest.areas.validation.controllers{ Public classDefaultcontroller:controller {//Get:validation/default PublicActionResult Index () {returnView (); } PublicActionResult Get (People p) {//verifies that this instance of the model-state dictionary is valid if(modelstate.isvalid) {//verify pass, Jump returnRedirect (""); } Else {
ASP. NET MVC ModelValidation(two)PrefaceThe previous section demonstrates a simple model validation example, and then mentions in the article where the model validation is located by default in the MVC framework. This article is to solve this problem, and will describe the type of object related to the Modelvalidator t
This article illustrates the many possibilities of sending emails in asp.net, covering such aspects as email format, priority, attachment and email encoding.
Asp. NET is given a new object to send email, named SmtpMail. When you use the SmtpMail object to send e-mail from a
RequiredFieldValidator (mandatory field validation) is used to check for input values
CompareValidator (comparison validation) compares two inputs by setting
RangeValidator (range validation) Enter whether the specified range
RegularExpressionValidator (regular expression validation) regular expression
in the system. Web. Mail namespace is the send method of the smtpmail object, which is called in the program to send emails. There are two ways to call this function:
I>. Direct call
The send method of the smtpmail object can be called as long as there are four parameters, that is, as long as there are four correct parameters, an email can be sent. The call format is as follows:
Smtpmail. Send ("mail Source Address", "mail target address", "mai
when the text error occursValidationExpression Property : Sets the regular expression to matchErrorMessage Error message----------------------------------------------------------------------------------------------------Custom validation Controls CustomValidatorControltovalidator the ID of the control to validatetext with error in textClientValidationFunction functions for client-side validationOnServerVal
The benefits of the ASP. NET validation control: 1, the client server side will be verified at the same time. 2, simplify the check logic.1,requiredfieldvalidator: non-null checkInitialValue: Default value. Cannot pass validation when the value of the control is equal to the default value. Text: Displays the error mess
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.