我想在<iframe src=''></iframe>
中呈现一个PartialView。渲染的PartialView有自己的JavaScript代码和CSS样式表。我尝试了两种方法来实现这个目标(但都没有成功):
在第一种解决方案中,我想知道是否可能返回一个RazorView对象(或类似的东西),它将具有可用的JavaScript代码和CSS样式表。有什么想法吗?
1) <iframe src="http://localhost:54351/Box/19"></iframe> public PartialViewResult Box(int id) { return PartialView(GetBox(id)); }
Result: the plain text (string), there is no the CSS sheet and the JavaScript code doesn't work
====================================
2)
<iframe src="@{ Html.RenderPartial("~/Views/Box.cshtml", @Model); }"></iframe>
Result: Obviously it's doesnt work, nothing shows inside the iframe