0

I have a dropdown list conatining some options. The last one is "other". When the user chooses the other option a textbox appears next to the drop down list. When the user chooses "other" he must enter a value into the textbox. Both, the dropdown list and the textbox, point to one single property of the the model. How do I achieve this using custom validation? what is the best solution?

Marco
  • 20,296
  • 6
  • 68
  • 109
user217648
  • 3,018
  • 7
  • 34
  • 54

1 Answers1

0

It seems what you're looking for is conditional validation. A very nice example is already mentioned in another question where you could create a custom RequiredIf attribute.

The topic has also been addressed frequently on stackoverflow.com

Community
  • 1
  • 1
Juliën
  • 8,273
  • 7
  • 48
  • 77
  • thanks but conditional validation is for two properties of the model. as I wrote both textbox and dropdown list are for one property. – user217648 May 22 '14 at 06:56