选择验证框架 - ASP.NET

发布于 2024-08-21 11:51:31 字数 115 浏览 5 评论 0原文

对于 Web 表单应用程序,您更喜欢哪种验证框架。这适用于相当大的复杂应用程序。我想在一个地方指定规则集和业务验证,并将其集成在客户端和服务器端。我更喜欢客户端使用 jquery。

有人有什么建议吗?

Which validation framework would you prefer for a webforms application. This would be for a rather large complex app. I would want to specify rulesets and business validation in a single place and integrate it both on the client and server side. I'd prefer jquery for client side.

Anyone has any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如歌彻婉言 2024-08-28 11:51:31

您可以查看.NET 3.5 DataAnnotations。因为它与 ASP.NET 集成得很好,但我不相信它支持规则集的概念。另一个选择是企业库验证应用程序块,它支持自定义规则集,但是,将其与 ASP.NET 集成会花费更多时间。不过,有一些在线材料可以帮助您入门。这里一篇文章(由我自己撰写)关于将 VAB 与O/RM 工具,这里是关于将 VAB 与 ASP 集成的一篇有趣的文章。网。

祝你好运。

You can look at .NET 3.5 DataAnnotations. because it integrates well with ASP.NET, but I don't believe it supports the concepts of rule sets. Another option is Enterprise Library Validation Application Block, which supports custom rule sets, however, it will take you slightly more time to integrate that with ASP.NET. However there is online material that should give you a kick start. Here an article (written by myself) about integrating VAB with O/RM tools and here is an interesting article about integrating VAB with ASP.NET.

Good luck.

旧城烟雨 2024-08-28 11:51:31

对于WebForms,标准验证器提供了良好的基础,如果您使用jQuery,您可以很容易地复制asp.net验证检查并做出相应的反应,即替换并向用户提供比验证摘要控件更好的反馈。

例如,您可以使用 jquery 找到验证控件,验证并获取要验证的控件到目标,这将有助于获取错误消息、更改表单字段类等。

For WebForms, the standard validators provide a good base, if you use jQuery, you can replicate the asp.net validation checks quite easily and react accordingly, ie replace and provide better feedback to the user than the Validation Summary control.

for instance you can find the validation controls using jquery, validate and get the control-to-validate to target, this will help in getting error messages, change form field classes etc.

扶醉桌前 2024-08-28 11:51:31

对于 Web 表单还是 MVC?以下是我到目前为止看到的选项:

  • JQuery 验证插件(仅限客户端)
  • XVal:xval.codeplex.com,具有客户端和服务器端组件,但我认为它只是 MVC。没有把握。我确实相信这与 JQuery 验证插件集成。
  • 企业库验证应用程序块 - 仅在我上次检查时服务器端,但提供逻辑的好方法。可以在配置文件中提供规则,作为代码或替代存储的属性。然后您可以使用 JQUery 验证前端。没有单一的客户端/服务器解决方案。
  • 标准 ASP.NET 验证器,可在客户端和服务器端工作。 ASP.NET 和 MVC 都有实现,就像您现在可能的那样。

For web forms or MVC? Here are the options I've seen so far:

  • JQuery validate plugin (client side only)
  • XVal: xval.codeplex.com, has client and server side components, but I think it's MVC only. Not sure. I do believe this integrates with teh JQuery validate plugin.
  • Enterprise library validation app block - server-side only last time I checked, but great way to supply your logic. Can supply rules in config file, as attributes on your code, or alternative stores. You could then use JQUery validate for the front-end. Not a single solution for client/server.
  • Standard ASP.NET validators, which does work client and server side. Both ASP.NET and MVC have implementations as you probably now.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文