views:

19

answers:

2

I have a ValidationGroup declared for my validator and button. But I see that there is this property for the textbox as well... do I need to assign this? What is the purpose of a textbox having a ValidationGroup when it is supposed to be the validator controls that have this?

A: 

No, you do not need to assign the ValidationGroup property on the Textbox. Assigning it to the validator is all you need to do.

citronas
+1  A: 

The TextBox has a ValidationGroup because it is possible for the TextBox itself to cause a post back to the server (if you set its AutoPostBack property to true). The ValidationGroup of the TextBox is the group of controls that are validated in this event.

If you are using a button to cause the post back event then the ValidationGroup on the TextBox does not need to be set.

There is more information on MSDN.

James Gaunt