Hi @Blooming Developer ,
I dont want to reload the page, could you please let me know whether i can use PageRemote for this.?
The PageRemote attribute uses client side script to validate user input on the server without posting the entire form. Generally, we can use it to check whether the input value is exist or not. Then, base on the request to show the validation message. It doesn't apply to your scenario: the conditional validation, based on one input (property) to validate or not validate another property.
So to the conditional validation, we have to use the custom validation attributes(such as the RequiredIfAttribute). And you also found that, by using the custom validation attributes, it will validate the data on server side, if you want to do the validation on client side. You have to add the custom client side validation.
You can refer the following sample code:
The RequiredIfAttribute.cs:
Add the custom client side validation:
You can view the source code from here: 185568-sourcecode.txt
The result like this: it will use the custom client side validation.
More detail information about custom client side valiation, see Custom client-side validation.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion