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

 

 

            
 
We are nothing without our users ! You can help us offer even more high quality content. Please share our page !
Best quality Asp .Net Ajax Control Toolkit tutorials.
Hi Thanks Anuj you saved my day.
22-Jan-2014 From  Raman
Welcome @Raman
28-Jan-2014 From  Anuj
Thanks. The page is loading now. I just added the code, with only the 'Path'/'Debug Path', to the Page_Load() function, in code behind, on my .aspx page. Hopefully leaving out the Cdn paths doesn't have any drastic side-effects. ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition { Path = "~/scripts/...", DebugPath = "~/scripts/..." });
31-Jul-2014 From  Pete
Thank you! I just added the below code inside my page load function. "ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition { Path = "~/scripts/...", DebugPath = "~/scripts/..." });" You saved ma time!
19-Nov-2014 From  Nish

Give your valuable comments.

Name
Email
Comment
8 + 5 =
 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2017 CodingFusion