开发者

How do I disable all the validators on a usercontrol?

开发者 https://www.devze.com 2023-03-11 08:18 出处:网络
I need to disable validation on the user control level.I am aware we can do this with propertie开发者_如何学编程s. Is there a way to disable all at a once in code?Perhaps by going through a loop or a

I need to disable validation on the user control level. I am aware we can do this with propertie开发者_如何学编程s. Is there a way to disable all at a once in code? Perhaps by going through a loop or a key? (I do not need to disable all validation at the page level, only the user control level)


Perhaps using Validation Groups would give you the flexibility you need?


You can write a loop to disable all validator controls.

foreach(BaseValidator bv in this.Controls)
{
     bv.Enabled = false;
}

But, prefered way is use Validation Group if it satisfies your requirement.

0

精彩评论

暂无评论...
验证码 换一张
取 消