Thursday, September 18, 2014

WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'

Sometime you found "WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'." in your ASP project when you are running the project.

As a remedy of the project  "Please add a ScriptResourceMapping named jquery(case-sensitive)." What is this ? How to solve this? Very easy stuff to do.

If your project if there is no Global.asax added then add one into your project by clicking on the Add New Item. After adding this you will see there is a method Application_Start. Add the following script into that method.

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.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.min.js",
  CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.js"
});

Now save the Global.asax and run your project. It will run successfully. :)

0 comments:

Post a Comment

Popular Posts

Pageviews