我是MVC的新手,我需要在iframe中放入一个返回页面内容(styles / css,text / html,图像等)的视图以及包含应用程序主菜单的视图,从索引视图。
任何人都可以帮我吗?
返回视图中内容的代码行是:
@Html.Raw(System.Text.Encoding.ASCII.GetString(@Model.Content))
答案 0 :(得分:1)
尝试使用返回视图的操作创建控制器。
public class MyController
{
public ActionResult Index()
{
return View();
}
}
索引视图内容:
@Html.Raw(System.Text.Encoding.ASCII.GetString(@Model.Content))
之后
<iframe src="localhost/mycontroller">
</iframe>