触发多个验证组,一个按钮? [英] Triggering multiple validation groups with a single button?

查看:152
本文介绍了触发多个验证组,一个按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设页面TestPage.aspx有两个控件。第一控制是具有所谓的AddressGroup验证组的地址控制。该组包​​含在上控制验证摘要colated几个验证控件。第二控制是信用卡控制,并具有所谓的CreditCardGroup验证组。它也有几个验证器和显示结果的总结。要添加的问题,还有在页面上一些随机的控件也有它们并列第三ValidatorSummary控制验证器。

Let's say the page TestPage.aspx has two controls. The first control is an address control that has a validation group called "AddressGroup". This group contains several validation controls which are colated in the validation summary on that control. The second control is a credit card control and has a validation group called "CreditCardGroup". It also has several validators and a summary to display the results. To add to the problem, there are some random controls on the page that also have validators which are tied to a third ValidatorSummary control.

当用户presses了难道这一切按钮,我想在网页触发所有三个验证组。按钮本身可连接到单个基或未标记基团。它不能只要我可以告诉绑多个组。

When the user presses the "Do it all" button, I would like the page to trigger all three validation groups. The button itself can be tied to a single group or an unlabeled group. It can not be tied to multiple groups as far as I can tell.

的解决方案是不从控制提取验证因为这将deminish在单独的控制具有他们的价值。感谢您的想法。

The solution is not to extract the validation from the controls as that would deminish the value of having them in seperate controls. Thanks for your thoughts.

推荐答案

你说的是客户端还是服务器端验证?杰米的答案是当场对服务器端,但对于客户端验证,你可能需要编写自己的JS函数,将触发所有三组演唱验证。

Are you talking client side or server side validation? Jamie's answer is spot on for server side, but for client side validation you will probably need to write your own JS function that will trigger validation on all three groups in concert.

这篇关于触发多个验证组,一个按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆