How do you send a controller action to a partial view in lieu of a model?
So I'm trying to add a partial view to my main view in MVC3, but the partial view needs new data. Instead of expanding the view model that has the necessary data in the main view and then passing it along to the partial view, is it possible to specify a controller action that directly feeds the partial view with the necessary model?
For example something like:
@Ht开发者_StackOverflowml.Partial("_PartialView", Controller, Action, Parameters)
Thanks in advance.
In a limited sense, yes.
The only thing you can do is send the current model over to another action through Html.Action Besides that you either need to add it to TempData, or pass what's required in the querystring through your GET parameters OR use an ajax request where you write these values to an html form and serialize that to your new page, but thats a hack : )
精彩评论