这是可行的,因为它以字符串形式返回部分视图呈现的结果:
@Html.Partial("Path/to/my/partial/view")
但我更喜欢使用RenderPartial
,似乎我需要写:
@{Html.RenderPartial("Path/to/my/partial/view");}
而不是:
@Html.RenderPartial("Path/to/my/partial/view");
才能让它正常工作。错误消息:
Compiler Error Message: CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments
有没有更好的方法来代替只为一次方法调用打开代码块@{...}
?
发布于 2012-06-15 17:47:21
@Html.Partial("NameOfPartialView")
发布于 2014-01-17 17:53:30
如果你得到了这种格式,它就像一个链接到另一个页面或另一个link.partial视图,主要用于将html文件从一个位置重新呈现到另一个位置。
https://stackoverflow.com/questions/6980823
复制相似问题