javascript - UnobtrusiveJavaScriptEnabled 键在 .NET 中有什么作用?

标签 javascript .net asp.net-mvc web-config

我很熟悉unobtrusive Javascript作为一种模式,但我很好奇它对 .NET 框架意味着什么。

我作为前端开发人员正在从事一个项目,该项目在后端使用 .NET。在与开发人员(同时管理服务器)合作时,他提到我们的项目必须将 UnobtrusiveJavaScript 设置为 false。也就是说,项目的 web.config 应具有以下内容:

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

我的第一 react 是这是不好的做法,但当我进一步思考时,我意识到我真的不明白为什么 .NET 甚至会在项目级别开始时有这样的设置,或者它是否甚至对我们的特定项目都很重要。

最佳答案

来自 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.

换句话说,您的应用程序可能具有依赖于执行验证的 Microsoft JavaScript 库的代码。

关于javascript - UnobtrusiveJavaScriptEnabled 键在 .NET 中有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31704703/

相关文章:

javascript - 删除下拉子菜单 onclick

javascript - 通过 Ajax 发送带有额外参数的表单数据?

c# - ASP MVC API 响应模型

C#泛型类型和存储库模式

javascript - 迭代object中的所有属性,查找并替换

.net - CQRS - 读取模型 DTO 混淆

.net - Application.Exit 没有杀死消息泵?

c# - 以编程方式解锁 applicationHost.config 中的部分

asp.net-mvc - 在 Web API c# MVC 中使用 HttpActionExecutedContext 时出现缓存问题

javascript - 绘制多个彼此相邻的旋转图像