C
chunt@kentuckycenter.org
Guest
Environment - currently using Sitefinity 11.0 since Sitefinity VSIX isn't up to date yet I am building a custom Sitefinity MVC widget. Surely the following can be done without a foreach loop but I can't seem to get the syntax correct. There will only be one matching page with the current productionSeasonId so firstordefault should work fine. //Collection of all page Nodes var pageNodes = App.WorkWith().Pages()..LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).Where(p => p.NodeType == NodeType.Standard && p.GetPageData().Status == ContentLifecycleStatus.Live).ThatArePublished().Get(); //Get page node where custom field "ProductionSeasonId" isn't null or empty and matches the current productionSeasonId foreach (var node in pageNodes) if (node.GetValue("ProductionSeasonId") != null && !node.GetValue("ProductionSeasonId").ToString().IsNullOrEmpty() && node.GetValue("ProductionSeasonId").ToString() == productionSeasonId) { showURL = node.GetUrl().Remove(0, 2); showInNavigation = node.ShowInNavigation; } }
Continue reading...
Continue reading...