tags:

views:

20

answers:

1

I am having a trying problem with a project I'm working on using ASP.NET MVC. I have an ActionResult which is called by jQuery ajax which posts a file to be saved in a temporary folder, the original view which contains the form and jQuery code is called "New".

I try to validate the filetype within the ActionResult which is called by the ajax file uploader. If the validation fails I add an error entry in the model error in the model state and try to return the original view hopefully displying the error to the user.

This unfortunately returns 2 of the same views one on top of the other with the valid error message, which is obviously not what I require. I have tried returning null instead of a viewresult, This stops the problem of multipe views being returned, but unfortunately the modelstate error message is not displayed.

Has anyone got any tips to help fix this issue?

A: 

If the call is in AJAX/JQuery you have to return the data in JSON so and show the error in jquery, you can't use Model Error. If you put some code we could help you.

VinnyG