将 ValidationSummary 限制为特定按钮

发布于 2024-07-14 23:22:23 字数 120 浏览 7 评论 0原文

我有一个场景,我正在使用新添加的 ValidationSummary 控件。 我正在处理的表单有多个按钮(客户搜索、提交等)。 是否可以仅在用户单击提交按钮(而不是客户搜索按钮)时触发 ValidationSummary?

I have a scenario where I'm using a newly added ValidationSummary control. The form that I am working on has multiple buttons (customer search, submit, etc). Is it possible to fire the ValidationSummary only when the user clicks the submit button, as opposed to the customer search button?

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

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

发布评论

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

评论(2

柠檬色的秋千 2024-07-21 23:22:23

在客户搜索按钮上,添加“CausesValidation='False'”

On the Customer Search button, add "CausesValidation='False'"

我早已燃尽 2024-07-21 23:22:23

执行此操作的最佳且最通用的方法是为摘要和所有要验证的控件以及提交按钮的 ValidationGroup 属性分配一个值。 只有具有相同 ValidationGroup 的控件才会受到影响。

使用验证组,您可以对页面的不同部分进行验证,而不会相互影响。 应大众需求,ASP.NET 2.0 中引入了此功能。

The best and most general way to do this is to assign a value to the ValidationGroup property for the summary and all the controls which are to be validated, as well as the submit button. Only controls with the same ValidationGroup are affected.

Using validation groups, you can have different parts of a page validate without affecting each other. This feature was introduced with ASP.NET 2.0 by popular demand.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文