开发者

CausesValidation to certain fields

开发者 https://www.devze.com 2023-01-16 19:43 出处:网络
I have a large ASP.NET page with many TextBoxes and Validators The problem is that when I click on a button, I want to fire the validation for certain TextBoxes (but not all of them). And when I clic

I have a large ASP.NET page with many TextBoxes and Validators

The problem is that when I click on a button, I want to fire the validation for certain TextBoxes (but not all of them). And when I click on another开发者_如何学运维 button, I want to fire all of the validators.


If I understand you correctly, you're looking for Validation Groups.

In this first case you'd call Page.Validate with only the first group. In the second, you'd call it twice, once for each group. This may not be allowed (I'm going off memory here). If that's the case then you need to loop over all your TextBoxes that need to be validated and call their Validate() methods individually.

0

精彩评论

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