开发者

How do I disable all the validators on a usercontrol?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜