ASP.NET MVC 2 Submitting from partials in different views
If I have a partial that is used in multi开发者_运维百科ple 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?
I think it's answered here: Retrieve the current view name in ASP.NET MVC?
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'
精彩评论