通过示范随着ViewData的对象局部图 [英] Pass Model Along With ViewData Object In Partial View

查看:166
本文介绍了通过示范随着ViewData的对象局部图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过模型与存储在ViewData字典一些对象一起。
我这样做的方式是 @ Html.Partial(_ DataPaging,模型,计算机['123'])。但是,这给出了部分方法有一些无效参数错误。
如何传递模型,我想局部视图里面使用一些其他的对象一起?

I want to pass Model along with some object stored in ViewData dictionary. The way I did this is @Html.Partial("_DataPaging", Model, ViewData['123']). But this gives an error that Partial method has some invalid arguments. How can I pass Model along with some other object which I want to use inside Partial View ?

推荐答案

好像 Html.Partial 方法的适当重载的方法签名是:

Seems like the appropriate overloaded method signature of the Html.Partial method is:

public static MvcHtmlString Partial(this HtmlHelper htmlHelper,
                                    string partialViewName,
                                    object model,
                                    ViewDataDictionary viewData);

和你的情况:

@Html.Partial("_DataPaging", Model, ViewData)

这意味着你将不得不提取物计算机[123] 手动内 _DataPaging 部分。

这篇关于通过示范随着ViewData的对象局部图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆