Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the UnobtrusiveJavaScriptEnabled key do in .NET?

I am quite familiar with unobtrusive Javascript as a pattern, but I am curious what it means to the .NET framework.

I am working on a project as a front-end developer that uses .NET on the back end. While working with a developer (who also manages the server), he mentioned that UnobtrusiveJavaScript must be set to false for our project. That is, the project's web.config should have the following:

<appSettings>
  ...
  <add key="UnobtrusiveJavaScriptEnabled" value="false" />
</appSettings>

My first reaction was that this was bad practice, but when I though about it further, I realized that I don't really understand why .NET would even have such a setting at the project level to begin with, or whether it even matters for our particular project.

like image 321
cloudworks Avatar asked Jul 29 '15 15:07

cloudworks


1 Answers

From here:

The purpose of that setting is explained by Brad Wilson in his post Unobtrusive Client Validation in ASP.NET MVC 3. Putting it short - with this setting turned off client side validation is being performed using Microsoft javascript libraries (the same way it was performed in ASP.NET MVC 1 and 2). Otherwise (with setting turned on) client side validation is performed using JQuery Validate.

So in other words, your application probably has code that depends on the Microsoft JavaScript libraries that perform validation.

like image 125
NightOwl888 Avatar answered Sep 28 '22 09:09

NightOwl888