WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for ‘jquery’

Today while working on ASP.Net web application in VS Express 2012 for Web, I got a strange error like this.

Error : WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for ‘jquery’. Please add a ScriptResourceMapping named jquery(case-sensitive).

Error : WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for ‘jquery’. Please add a ScriptResourceMapping named jquery(case-sensitive).

It was strange because I just added some basic components like TextBox, Requiredfield Validator, and validation summary controls only. Later I found one Microsoft Connect issue. And according to the connect website we can fix this by removing following element from the web.config file.

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

But I couldn’t find this element in my web.config file :( The another option to fix this issue is registering JQuery in Global.asax,in the Application_Start event like this

ScriptManager.ScriptResourceMapping.AddDefinition("jquery", 
    new ScriptResourceDefinition
{
Path = "~/scripts/jquery-1.7.2.min.js",
DebugPath = "~/scripts/jquery-1.7.2.min.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"
});

And it worked without any issue. Adding following element in the web.config also works.

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

You can find more about Unobtrusive JavaScript on Wikipedia

Happy Programming :)

2 thoughts on “WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for ‘jquery’

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA Image

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>