I have two instances of a user control on a page. Both have fields and one submit button.
I have set validation groups on the fields and validators but for some reason when validating the two user controls’ validators fire.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could expose a property
ValidationGroupin your UserControl that you would set from the Page. This value should be stored in ViewState, so that every instance of the UserControl will get different ValidationGroups(if your page assigns different).For example:
If you need different ValidationGroups in your UserControl the above recursive function won’t work, then you could assign it manually from codebehind. For example by putting the UserControl’s ID(might suffice) or ClientID in front of the ValidationGroup properties of the according controls. A good place where you could call this function would be
PreRender.