I have a form with various values to enter by the user, then the user sends the query and processes the search for result.
This is pretty simple, but the problem is this.
In MVC if the form has errors, to do validation on the server should show the form again with errors. but if I send my request to the data search action, I should come back with a redirect to the consultation action form and this would lose validation messages.
Currently we do is request the data to the action of the consultation form and then if everything is fine, we redirect action result sending the data of request with tempdata.
Is there any better way for this scenario?
If I understand correctly, PRG pattern should work in your case. In post operation, if modelstate is invalid, redirect back to consultation form otherwise proceed with search operation. The filters will internally save the errors in tempdata.
MVC3 model validation best practice redirect after post / state change