Posted 2006-12.
One problem with the M$ page model is how multiple validators and server controls interact. For example, both textboxes below are associated with a requiredfieldvalidator. By default, however, neither button's event handler will run unless both textboxes are filled. In other words, all validators run in a "global" scope and you can't separate them into logical sections. If that doesn't make sense, try it out:
If you're working with the 1.x Framework one solution to the problem is described here. The 2.0 Framework fixes the problem with Validation Groups. In the example above, set the validationgroup property for each server control (validator, textbox, and button) on the right side of the table to the same string ('SET_THIS' below):
<asp:textbox id='text' runat='server'
validationgroup='SET_THIS'
/>
<asp:requiredfieldvalidator id='VALIDATOR_ID' runat='server'
validationgroup='SET_THIS'
controltovalidate='text'
/>
</div>
<div>
<asp:button id='BUTTON_ID' runat='server'
validationgroup='SET_THIS'
text='Submit'
oncommand='YOUR_EVENT_HANDLER'
/>
After doing the same (setting the
validationgroup property to any string
except 'SET_THIS') for each server control on the left side of the table, the validators will work independently.
Try it - set validationgroup property for all server controls.