views:

1799

answers:

4

How do i return a partial view inside a master page after submitting a form. Basically what i'm trying to do is display form validation errors, but the problem i can only manage to return a partial view not the master page or full view that its in. Any suggestions?

+1  A: 

I'm using MS Mvc with spark + jquery so I'm not sure if it solves your problem but what I think you have to do is return a partial and say which part of page have to be updated (by id of DOM element).

buddy
+1  A: 

Is ajax an option? An XMLHttpRequest could refresh just the partial view, not break your architecture, and keep the page from refreshing. I would use jquery.

marr75
+1  A: 

This might help.

Arnis L.
+1  A: 

The solution i ended up doing was passing the ModelState in TempData and adding the errors back into ModelState in the partialview. It works where other solutions did not. Also performed client side validation as well but thats kind of irrelevant as i was after a server side solution.