Search code examples
javascriptjqueryasp.netasp.net-membershiplogin-control

login control error


When I add the login control to the page, I got the following error. Could u help me ?

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


Solution

  • 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" />
    

    http://connect.microsoft.com/VisualStudio/feedback/details/735928/in-asp-net-web-application-visual-basic-the-requiredfieldvalidator-doest-work

    Edit:

    From the comments below, if the ValidationSettings:UnobtrusiveValidationMode is set to WebForms rather than removing it, you can change the value to None as shown below:

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