Last post Mar 16, 2016 07:15 AM by Zhi Lv - MSFT
Mar 15, 2016 01:43 PM|sudip_inn|LINK
suppose i have a checkbox and textbox. if social security no checkbox is checked then user has to enter social security no in a textbox. if social security no checkbox is not checked then social security no textbox can be submitted with empty. how to achieve
it in MVC?
if possible discuss with sample code example. thanks
Mar 15, 2016 03:18 PM|PawanPal|LINK
The same has been discussed here also: http://forums.asp.net/t/1924941.aspx?Conditional+Validation+using+DataAnnotation
Mar 15, 2016 03:21 PM|ignatandrei|LINK
Also, you may want to verify in the backend to verify this business logic( IValidatableObject)
Mar 15, 2016 05:40 PM|sudip_inn|LINK
i want to achieve it with unobtrusive validation at client side.
Mar 16, 2016 07:15 AM|Zhi Lv - MSFT|LINK
I suggest you could refer to the following articles:
You could override the Validate method, and create the custom conditional validation.