MVC从父视图访问Viewbag值

时间:2015-08-25 14:53:40

标签: asp.net-mvc razor

我有查看“child.cshtml”继承自“_Parent.cshtml”,在_Parent.cshtml上我有:

ViewBag.Title = "some value";

在child.cshtml上我有:

@{
    Layout = "_Parent.cshtml";
}
<h1>Here i want to put layout title</h1>

如何从Parent.cshtml访问child.cshtml视图中的ViewBag.Title值?

0 个答案:

没有答案