WebForms Unobtrusivevalidationmode needs "jquery" scriptresourcemapping.

Source: Internet
Author: User

People who believe that there is an ASP. NET learning experience must not be unfamiliar with the RequiredFieldValidator control (validation of a non-empty control), which is forbidden to enter the specified content (that is, the value of the property InitialValue, the default value of the property is an empty string, We often use it to verify that the content entered by the user is empty. )。 In addition, spaces at both ends of the input are automatically removed before validation.


today, when you practice the use of the control, you encounter the following problems:



cause of error

VisualStudio 2012 (or) WebForm 4.5 development, many controls by default enable the unobtrusive Validationmode (so-called unobtrusive Validation, is a property of implicit authentication (related to the reference to jquery), but it is not assigned a value, programmer must be set manually. For example, the various validator used for data validation (the RequiredFieldValidator control used today), and the authorization and authenication settings, Because jquery is required to be called on the front-end for authentication, unobtrusive Validationmode is the default enable. If this property is not configured, an error is generated.


Workaround

From the cause of the error we can easily remedy the situation, from the wrong reasons we have to solve the problem of the method is nothing but three:

1, in the case of allowing the program to reduce. The version of the framework, in the following ways:

<!--modified before--><system.web>    <compilation debug= "true" targetframework= "4.5"/>

2. Change the type of the Web. config profile setting unobtrusive Validationmode as follows:

<!--modified before--><system.web>    <compilation debug= "true" targetframework= "4.5"/>

3. Locate the appropriate jquery (ASPNET.SCRIPTMANAGER.JQUERY.DL) file and copy it to the Bin folder.

Since I am a new empty Web application, I did not add jquery. We can paste the corresponding jquery file into the folder mentioned above by creating a new non-empty Web application.

The above three methods of personal comparison tend to the third, the first, the second to give people a sense of escape problems, the third method is to find the problem to solve the problem of the kingly (personal understanding). At the same time, in the process of solving this problem also read a lot of blogs, everyone also more or less give a similar method, but to describe the cause of the problem is very few. This may be part of the reason why Chinese Software page cowgirl.

(Rookie my book, if you have a mistake to advise)

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

Reprint Please specify 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.