Aspnet solve problem of multiple user control with validator
The problem is described in this post, basically it can be summarized in you have a user control with validators, you put more than one instance of the user control in a page, all validators are fired together
The above post already gives a solution, but is not a general one. I want to avoid the need to go into the user control and tweak with validators, so I came up with this little solution
The function AssignValidationGroup accepts a Control, then it iterates recursively into inner controls, and for each control that descends from BaseValidator, it assign a group name based on the id of the root control. Now in the load event of a page that instantiate more than one instance of a user control with validator I can write.
This automatically assign different validation group to both the user control.