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

If you receive the WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery' error, put the following lines of code in the Appliction_Start method in the Global.asax.cs file

        protected void Application_Start(object sender, EventArgs e)
{
string jqueryVersion = "1.8.0";

System.Web.UI.ScriptManager.ScriptResourceMapping.AddDefinition("jquery",
new System.Web.UI.ScriptResourceDefinition
{
Path = "~/Scripts/jquery-" + jqueryVersion + ".min.js",
DebugPath = "~/Scripts/jquery-" + jqueryVersion + ".js",
CdnPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery" + jqueryVersion + ".min.js",
CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery" + jqueryVersion + ".js",
CdnSupportsSecureConnection = true,
LoadSuccessExpression = "Window.jquery"

});
}


The above lines of code registers the jQuery library with the ScripManager. This will get rid of the error, you can do the same this with jQueryUI library.

Comments

Popular posts from this blog

Installing AdventureWorks Sample Databases from Microsoft

SQL: GROUP BY And HAVING

ASP.NET : Create an Empty Web Application Project in Visual Studio 2012