Reputation: 2107
I went through a few blogs/posts and there are some good solutions for input validations in Mvc 1.0, but most of them are about non-Ajax scenarios, so I was wondering what your preferred method is when using jQuery Ajax?
Upvotes: 1
Views: 270
Reputation: 105059
I've just blogged about Asp.net MVC, Ajax and model validation error handling. Could be useful to you. The main thing is that you can easily do model validation as long as you can bind data to a strong type model (naming input fields does the trick). Going a step further, handling model validation errors is covered in my linked blog post.
I'm using custom exception with a custom exception action filter that proved to work fine in such situation. And the best thing is that you can still use error
and success
options of the $.ajax()
call. Which is in my opinion the proper way of doing it.
Upvotes: 1
Reputation: 5131
In asp.net mvc 1.0 you don't really have many options for validation. It is absolutely required to have server-side validation and I usually make my own custom validation. It is also good to have client side validatio that is easy to do with jQuery. There are several good projects for automated validation like MVCValidationToolkit and xVal that you can try.
Upvotes: 1