当我尝试渲染其模型类型指定为的局部视图时:
@model dynamic
通过使用以下代码:
@{Html.RenderPartial("PartialView", Model.UserProfile);}
我得到以下异常:
'System.Web.Mvc.HtmlHelper<dynamic>' has no applicable method named 'RenderPartial' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.
但是,.aspx 文件中的相同代码可以完美运行。有什么想法吗?