Click here to Skip to main content
15,884,920 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Server-side validation: Using [Required] attribute it's to validate the text field, but here, checkbox value decides the text fields should exist or not. So, if attributes used for validation, it throws an error.

It can be accomplished in client-side. But I have to validate this from server-side.

I came through preprocessor directives since it is simply hardcoded, It's not helpful.
how to validate text field based on condition (server-side)

What I have tried:

I've done field validation from client-side, how to do it from server side?
Posted
Updated 28-Dec-17 9:32am
v2
Comments
[no name] 27-Dec-17 17:02pm    
Share your code what you have tried for this?
Sathya5995 28-Dec-17 2:18am    
Thanks for your response. I found the way, we can have a custom class with attribute class extended. using that class in the attribute can validate my property with respect to bool value.
[no name] 28-Dec-17 8:54am    
ok

1 solution

As mentioned in the comments, you found a way to get what you needed so posting something to get this out of the unanswered list.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900