WebForms Unobtrusivevalidationmode needs "jquery" scriptresourcemapping

Source: Internet
Author: User

In the beef Brisket news Release system encountered this error, with the help of friends expensive to solve successfully. Share to everyone.

error:

cause Analysis :

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.

Solution:

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

<span style= "FONT-SIZE:18PX;" ><!--modified before--><system.web>  <compilation debug= "true" targetframework= "4.5"/>< HttpRuntime targetframework= "4.5"/> <!-Delete it--></system.web><!--modified--><system.web>  <compilation debug= "true" targetframework= "4.0"/></system.web></span>
B. Change the type of the Web. config profile setting unobtrusive Validationmode as follows:

<span style= "FONT-SIZE:18PX;" ><!--modified before--><system.web>  <compilation debug= "true" targetframework= "4.5"/>< HttpRuntime targetframework= "4.5"/></system.web><!--modified--><system.web>  <compilation Debug= "true" targetframework= "4.5"/>
Third, this method may be somewhat complex, but also feasible. Here's how:

1. Create a new scripts folder at the root of the website, add jquery-1.7.2.min.js and jquery-1.7.2.js to it (you can use a different version depending on your needs).

2. Add the Global Application class Global.asax file under the root directory and add the following code to the Application_Start event:

<span style= "FONT-SIZE:18PX;" >scriptmanager.scriptresourcemapping.adddefinition ("jquery", new Scriptresourcedefinition {Path = "~/scripts/ Jquery-1.7.2.min.js ", Debugpath =" ~/scripts/jquery-1.7.2.js ", Cdnpath =" http://ajax.microsoft.com/ajax/jQuery/ Jquery-1.7.2.min.js ", Cdndebugpath =" Http://ajax.microsoft.com/ajax/jQuery/jquery-1.7.2.js "});</span>
looked up a lot of information, all tried, these three methods are feasible, hope to help everyone, hey!





WebForms Unobtrusivevalidationmode needs "jquery" scriptresourcemapping

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.