views:

24

answers:

1

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.

+2  A: 

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.

colithium
you understand me and this is what I am looking for...thanks!
fadi
No problem, glad I could help. If this resolved your issue, you could accept this as the correct solution.
colithium
I going to accept your answer but the site tells me thea I should wait 3 minutes...
fadi
BTW can I assign more than a group to a single button ?
fadi
Unfortunately, no you cannot. I really wish they would change that though.
colithium