websss
asked on
update viewbag item in layout.cshtml from partial view
Hi
I have a site that loads different logos etc depending on the URL you enter on
I have the following areas in a _Layout.cshtml file
then in the controller I populate these
This all works fine for these
However its not working for this
I assume because its a partial view and not a view?
Can you suggest a way to get this working with a paritial view
Or better yet do this population of the layout in one place rather than every view for different pages?
I have a site that loads different logos etc depending on the URL you enter on
I have the following areas in a _Layout.cshtml file
<title>@ViewBag.PageTitle </title>
<img id="logo" src="@ViewBag.Logo" />
<span class="txt-color-white">@ViewBag.Footer</span>
then in the controller I populate these
ViewBag.Logo = site.BrandingLogo;
ViewBag.Title = site.BrandingPageTitle;
ViewBag.Footer = site.BrandingFooter;
This all works fine for these
public ActionResult Index()
..
return View();
However its not working for this
public ActionResult LoadGraph(string GroupId)
..
return PartialView(model);
I assume because its a partial view and not a view?
Can you suggest a way to get this working with a paritial view
Or better yet do this population of the layout in one place rather than every view for different pages?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.