开发者

How do you send a controller action to a partial view in lieu of a model?

开发者 https://www.devze.com 2023-04-01 03:54 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号