Modifying MVC 3 ViewBag in a partial view does not persist to the _Layout.cshtml

后端 未结 10 1839

I am using MVC 3 with the Razor view engine. I want to set some values in the ViewBag inside a Partial View and want retrieve those values in my _Layout.cshtml. For exampl

10条回答
  •  独厮守ぢ
    2020-12-08 14:08

    try @SLaks code with

    (((WebViewPage) WebPageContext.Current.Page).ViewBag).PropertyName
    

提交回复
热议问题