- 130
Hello-
I am adding our company logo to our main slider images, and I am wanting to stop the theme-defined logo from appearing on the home page ONLY.
I opened my /Views/Shared/_Root.cshtml and see this variable is defined:
Further down on same view, I see where the Header page is called:
But in the Header.cshtml, when I try to reference the "isHomePage" variable:
....I get this error:
The name 'isHomePage' does not exist in the current context
My question is:
Isn't it possible for a partial view to see the variables defined on it's parent/calling document?
If so, on the Header.cshtml, how can I properly refer to the variable created on _Root.cshtml for my conditional code to execute correctly?
Thank you!
I am adding our company logo to our main slider images, and I am wanting to stop the theme-defined logo from appearing on the home page ONLY.
I opened my /Views/Shared/_Root.cshtml and see this variable is defined:
isHomePage = true;
Further down on same view, I see where the Header page is called:
<div class="home-page-header main-slider-header">
@Html.Partial("Header")
</div>
But in the Header.cshtml, when I try to reference the "isHomePage" variable:
@if (isHomePage)
{
@* do not show logo *@
}
else
{
<a href="@Url.RouteUrl("HomePage")" class="logo">
@if (!MvcHtmlString.IsNullOrEmpty(alfrescoLogo))
{
@alfrescoLogo
}
else
{
string storeName = EngineContext.Current.Resolve<IStoreContext>().CurrentStore.GetLocalized(x => x.Name);
<img title="" alt="@storeName" src="@Url.Content(logoPath)">
}
</a>
}
....I get this error:
The name 'isHomePage' does not exist in the current context
My question is:
Isn't it possible for a partial view to see the variables defined on it's parent/calling document?
If so, on the Header.cshtml, how can I properly refer to the variable created on _Root.cshtml for my conditional code to execute correctly?
Thank you!