1

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?

2 Answers 2

1

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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.