views:

81

answers:

1

Hi:

I've just finished reading up on the CustomValidator control and I have a question. In the book I'm reading, it says that a CustomValidator doesn't need to have it's ControlToValidate property set and it gives a few examples of that usage. But in one example where ControlToValidate isn't used, the OnServerValidate function has a timer (5 seconds) that you need to beat by entering your 'answer' into a textbox. If it takes you longer than 5 seconds, the CustomValidator's error message pops up next to the textbox (it's like a timed question/answer game) . How did the CustomValidator know to place the message next to the textbox (there's no association between the two, that I know of)? I wanted to test this, so I put a couple more textboxes on the page and the error message always showed up next to the last textbox I placed on the page. Thanks.

+3  A: 

The error message shows up at the location of the CustomValidator control, it has nothing to do with the location of the TextBox. Also, if you have a ValidationSummary control on the page, it shows up there as well.

Pent Ploompuu
Ah... thank you. That's so obvious too.
400_the_cat