Page.IsValid和args.IsValid之间是什么关系 [英] What is relationship between Page.IsValid and args.IsValid

查看:100
本文介绍了Page.IsValid和args.IsValid之间是什么关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Page.IsValid和args.IsValid是否彼此依赖?

Is Page.IsValid and args.IsValid depend each on other?

我的意思是如果args.IsValid ="true",则Page.IsValid必须为"true".

I mean if args.IsValid="true" the Page.IsValid must be "true".

当然,相反:如果Page.IsValid ="true",则为args.IsValid ="true"

And ofcourse conversely: if Page.IsValid="true" so args.IsValid="true"

推荐答案

Page.IsValid (只读),当页面验证成功时返回true;否则,返回true.否则为假.

Page.IsValid (readonly) returns true when page validation succeeded; otherwise, false.

阅读 MSDN文档.

为使此属性​​返回true,所有验证服务器控件都位于当前的验证组必须成功验证.你应该仅在调用Page.Validate后检查此属性方法,或在中将CausesValidation属性设置为true用于ASP.NET服务器控件的OnServerClick事件处理程序启动表单处理.

For this property to return true, all validation server controls in the current validation group must validate successfully. You should check this property only after you have called the Page.Validate method, or set the CausesValidation property to true in the OnServerClick event handler for an ASP.NET server control that initiates form processing.

ServerValidation 处理程序中;如果输入验证(args.Value)分别成功或失败,则可以将 true false 设置为 ServerValidateEventArgument.IsValid 属性.

In ServerValidation handler; You may set true or false to ServerValidateEventArgument.IsValid property if input validation (args.Value) is succeed or failed respectively.

MSDN文档

一旦您的验证例程完成,请使用IsValid属性来指示是否传递了由Value属性指定的值验证.此值确定输入控件是否关联CustomValidator控件通过了验证.

Once your validation routine finishes, use the IsValid property to indicate whether the value specified by the Value property passed validation. This value determines whether the input control associated with the CustomValidator control passed validation.

这篇关于Page.IsValid和args.IsValid之间是什么关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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