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
  • 22,856
  • 9
  • 75
  • 124
user217648
  • 3,338
  • 9
  • 37
  • 61

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
  • 9,047
  • 7
  • 49
  • 80
  • 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