2
votes

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?

4
i'd rather a solution that didn't rely on ajax to start with... - user125140

4 Answers

1
votes

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).

1
votes

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.

1
votes
1
votes

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.