Click here to Skip to main content
Click here to Skip to main content
Technical Blog

WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jQuery

, 28 Nov 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
A solution to the problem.

Today while working on an 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, RequiredfieldValidator, and validation summary controls only. Later I found a Microsoft Connect issue. And according to the Connect website, we can fix this by removing the 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. Another option to fix this issue is registering jQuery in Global.asax in the Application_Start event like this:

    new ScriptResourceDefinition
Path = "~/scripts/jquery-1.7.2.min.js",
DebugPath = "~/scripts/jquery-1.7.2.min.js",
CdnPath = "",
CdnDebugPath = ""

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

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

You can find more about Unobtrusive JavaScript on Wikipedia.

Happy programming


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Anuraj Parameswaran
Technical Lead
India India
Working as Tech. Lead
My blog :
You can follow me in twitter : @anuraj
Follow on   Twitter   Google+

Comments and Discussions

QuestionWebForms UnobtrusiveValidationMode PinmemberAmey A khedekar9-Jul-14 19:39 
GeneralMy vote of 3 PinmemberKedar Kulkarni19-May-14 4:47 
QuestionScriptManager does not exist PinmemberKedar Kulkarni19-May-14 4:45 
AnswerRe: ScriptManager does not exist PinmemberAnuraj Parameswaran22-May-14 20:59 
GeneralRe: ScriptManager does not exist PinmemberKedar Kulkarni27-May-14 6:07 
GeneralRe: ScriptManager does not exist PinmemberAnuraj Parameswaran28-May-14 20:39 
QuestionI tried this solution but now the RequiredField validator message appears in black instead of red. PinmemberMember 107385869-Apr-14 23:08 
GeneralMy vote of 5 PinmemberBharat Mallapur24-Oct-13 22:18 
Questionhow to add Global.asax PinmemberMember 986304725-Feb-13 6:20 
Questionfrnds...I am struggling to apply this line in Webconfig PinmemberMember 986304725-Feb-13 6:12 
QuestionThanks PinmemberJixian3-Jan-13 0:41 
QuestionReolved differently PinmemberGaurang Naik20-Nov-12 23:16 
AnswerRe: Reolved differently PinmemberVijay Kanda27-Nov-12 22:15 
AnswerRe: Reolved differently PinmemberAnuraj Parameswaran27-Nov-12 22:53 
I agree, but if we want to use .Net Framework 4.5, this fix won't work right?
GeneralRe: Reolved differently [modified] Pinmemberpraleesha5-Apr-13 6:43 
AnswerRe: Reolved differently PinmemberThe Stonx21-Mar-13 10:47 
AnswerRe: Reolved differently Pinprofessionalosmanrahimi26-Nov-14 3:36 renamed to Pinmemberdirq12-Nov-12 5:27 
AnswerRe: renamed to PinmemberAlexandre Toledo Perez13-Feb-13 8:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150305.1 | Last Updated 28 Nov 2012
Article Copyright 2012 by Anuraj Parameswaran
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid