3

I programmed a web user control that basically lets the user choose whether she is a registered member or unregistered member, and to fill fields accordingly, i.e., if the user is member she is asked to provide her username and password and the sign up field are being disabled. if the user is not registred then she is asked to provide registration information and the login fields are being disabled. A very common practice, I assume.

each option has its own 'ValidationGroup' on the fields. i.e. the login fields have ValidationGroup="Login", the registration fields have ValidationGroup="SignUp".

My problem is that when I place this WebUserControl on some page none of the fields are being validated (only the webpage's fields are being validated). If I remove the ValidationGroup from all the fields in my user control then all of them are being validated but in that case if the user is signing up then the login fields are also validated and the validation fails.

Any Ideas how to overcome this?

Thanks a lot, Assaf.

Assaf
  • 31
  • 1

1 Answers1

0

It's not very pretty, but I'd just set CausesValidation to false in the codebehind in certain events. Ie when your user signs up.

Heki
  • 926
  • 2
  • 15
  • 34
  • Thank you very much. I'm so tired from this problem that I'll try anything. However any other solutions will also be appreciated. – Assaf Nov 16 '10 at 22:05
  • 1
    The button that logs your users in, does it belong to the validation group "Login", and does the other button that signs users up belong to the "SignUp" validation group? – Heki Nov 18 '10 at 11:30