WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).

First problem I have faced after installed Visual Studio 2012 and created my first application  is this error:

 

WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).

 

However I was not trying to do any fancy stuff. I have just created simple form with Required filed validators(Done thousands of time). I ran the code and press submit button and Bang. A quick google search solved my problem and also provide me information about the problem.

As per Microsoft:

When targeting .NET 4.5 we enable Unobtrusive Validation by default. You need to have jQuery in your project and have something like this in Global.asax to register jQuery properly:

            ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition {

                Path = "~/scripts/jquery-1.4.1.min.js",

                DebugPath = "~/scripts/jquery-1.4.1.js",

                CdnPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.1.min.js",

                CdnDebugPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.1.js"

            });

Replacing the version of jQuery with the version you are using. You can also disable this new feature in web.config by removing the following line:

    <add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms" />

 

The templates in the RC milestone will have all of this wired up automatically for you.

 

Solution:
Just add these lines to your web.config

 

 

            
 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice