How can I prevent DataTables from calling the server if a server side validation error occurs?

How can I prevent DataTables from calling the server if a server side validation error occurs?

edhalsimedhalsim Posts: 5Questions: 3Answers: 0

Sorry if this is a duplicate question. I'm working with DataTables 1.10 and ASP.NET MVC 5. I have an Index view/form that contains three fields: ZipCode, City, and State, a Search button, and a DataTables control. I want to implement server side validation to check the values of Zip, City, and State when the Search button is pressed. I've implemented a server side ValidationAttribute class that returns ValidationResult when an error is detected.

What I want to do is if any errors exist back from the server, prevent DataTables from calling its server method (/controller/AjaxHandler). Since the Datatables control does not "know" of the other three fields on the page, how would I stop it from doing its thing?

Thanks for your time.
- Ed.

This discussion has been closed.