In document type I've created a true/false property (fwbgCarousel) that shall initialize the bootstrapcarousel as a full width carousel (or just a carousel in the grid)
@{ if (uQuery.GetCurrentNode().GetAncestorOrSelfNodes().Any(x => x.GetProperty("fwbgCarousel"))) { Html.RequiresCss("~/css/fwbgcarousel.css"); } }
@CurrentPage.GetGridHtml("content", "bootstrap3")
But the problem is, when I use the same template in content, and some pages shall have full width, and most of the pages not shall have full width (on/off), this true/false settings don't seem to read fwbgCarousel property for every page, but hang and don't refresh the template for every page.
The <link href="/css/fwbgcarousel.css?cdv=1570503641" type="text/css" rel="stylesheet"/> text don't change/disappear for every new page recalled from this template.
Caching problem?
In document type I've created a true/false property (fwbgCarousel) that shall initialize the bootstrapcarousel as a full width carousel (or just a carousel in the grid)
The template:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using ClientDependency.Core.Mvc
@{
Layout = "Master.cshtml";
Html.RequiresCss("~/css/bootstrap.min.css");
Html.RequiresCss("~/css/font-awesome.min.css");
Html.RequiresCss("~/css/rte.css");
Html.RequiresCss("~/css/style.css");
Html.RequiresCss("~/css/carousel.css");
}
@{
if (uQuery.GetCurrentNode().GetAncestorOrSelfNodes().Any(x => x.GetProperty("fwbgCarousel")))
{
Html.RequiresCss("~/css/fwbgcarousel.css");
}
}
@CurrentPage.GetGridHtml("content", "bootstrap3")
But the problem is, when I use the same template in content, and some pages shall have full width, and most of the pages not shall have full width (on/off), this true/false settings don't seem to read fwbgCarousel property for every page, but hang and don't refresh the template for every page.
The <link href="/css/fwbgcarousel.css?cdv=1570503641" type="text/css" rel="stylesheet"/> text don't change/disappear for every new page recalled from this template.
What is the solution here?
Hi Tom,
Why did you use .GetAncestorOrSelfNodes().Any() ?
Try just current page:
Thanks, Alex
Just because I find 3 examples here: https://our.umbraco.org/forum/developers/razor/43529-Recursive-usage-of-data-type-TrueFalse, and that was the only one who work without modifications.
But your solution works for me, so this is absolutly perfect. THANKS! :-)
You are welcome ))
is working on a reply...