Thursday, December 14, 2017

How to solve “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)



This error comes when we use RequiredFieldValidator control on any other server control in asp.et web applictaion. We can solve this error by enabling pre 4.5 validation mode by adding an appsetting key in web.config.



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



What happened when we add this key?


Adding this key specifies how ASP.NET globally enables the built-in validator controls to use unobtrusive JavaScript for client-side validation logic. As said here

Remarks: If this key value is set to "None" [default], the ASP.NET application will use the pre-4.5 behavior (JavaScript inline in the pages) for client-side validation logic. If this key value is set to "WebForms", ASP.NET uses HTML5 data-attributes and late bound JavaScript from an added script reference for client-side validation logic.




No comments:

Post a Comment