WebForms UnobtrusiveValidationMode requires "jquery" ScriptResourceMapping.

Source: Internet
Author: User

I believe there have been ASP. NET learner must be familiar with the RequiredFieldValidator control (to verify non-empty controls). The function of this control is to prohibit the input of specified content (that is, the value of the attribute InitialValue, the default value of this attribute is an empty string, which is often used to verify whether the content entered by the user is null .). In addition, spaces at both ends of the input content are automatically removed before verification.


Today, I encountered the following problems when practicing this control:



Error cause

In the development of Visual Studio 2012 (or 2013) WebForm 4.5, many controls Enable Unobtrusive ValidationMode by default (the so-called Unobtrusive Validation is an implicit verification method) but it is not assigned a value. Programmer must manually set it. For example, various validator controls used for data verification (RequiredFieldValidator control used today) and authorization and authenication settings need to be performed by calling jquery on the front end for authentication, both Enable the Unobtrusive ValidationMode by default. If this attribute is not configured, an ERROR occurs.


Solution

From the cause of the error, we can easily remedy the problem. From the cause of the error, we can solve the problem in three ways:

1. Reduce the. Framework version as permitted by the program as follows:

<! -- Before modification --> <system. web> <compilation debug = "true" targetFramework = "4.5"/> 

2. Change the Unobtrusive ValidationMode type in the Web. config configuration file. The specific method is as follows:

<! -- Before modification --> <system. web> <compilation debug = "true" targetFramework = "4.5"/> 

3. Find the corresponding Jquery (aspnet. scriptmanager. jquery. dl) file and copy it to the bin folder.

Jquery is not added because I am a new empty Web application. You can create a non-empty Web application to paste the corresponding Jquery file to the folder mentioned above.

 

The above three methods tend to be the third method. The first and second methods give people a sense of escaping from the problem. The third method is the way to solve the problem when the problem is discovered (personal understanding ). At the same time, I have also read a lot of blogs in the process of solving this problem. Everyone has provided similar methods more or less, but there are few reasons to describe the problem. This may be part of the reason why Chinese software pages are subject to humans.

 

(If you have any questions about cainiao, I hope you will not give me any advice)

 

Help link: http://www.shaoqun.com/a/56680.aspx

Reprinted please indicate the source: http://blog.csdn.net/senior_lee






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.