If I have a partial that is used in multiple views that submits to its own dedicated action, then how do I know which view it has come from so I can go back to that view?
Asked
Active
Viewed 116 times
2 Answers
0
I think it's answered here: Retrieve the current view name in ASP.NET MVC?

Community
- 1
- 1

abieganski
- 550
- 4
- 9
-
OK, but its not a beautiful way of doing it. I'm having trouble with partials. What if a partial needs to submit? Where should it post to, a dedicated action? If so, what happens on model validation failure, and how to I rebuild the view even if I do use the method explained in the link above? – Rob Mar 23 '11 at 16:25
0
Just to clarify - How do you mean 'so you can go back to that view' If you use ajax forms ie Ajax.BeginForm for each of those partial views, they will all automatically handle their own psots to the url (hence controller) and can live peacefully in the parent view no matter which view it is.
if model validation happens, then you will see it in those partial views and modelstate will repopulate the posted values into the model for the user to 'fix'

Adam Tuliper
- 29,982
- 4
- 53
- 71