Error executing template "Designs/Baseline/partials/layout/navigation.cshtml"
System.ArgumentException: Argument 'rowId' must be greater than zero. Value was: '0'
at Dynamicweb.Core.Ensure.That[TException](Boolean condition, String message)
at Dynamicweb.Content.GridService.GetGridRowById(Int32 rowId)
at Application.Extensions.ThemeExtensions.<>c__DisplayClass0_0.<GetFirstParagraphTheme>b__0(Paragraph x) in C:\actions-runner\_work\musikkens-hus-dynamicweb\musikkens-hus-dynamicweb\Application\Extensions\ThemeExtensions.cs:line 31
at System.Linq.EnumerableSorter`2.ComputeKeys(TElement[] elements, Int32 count)
at System.Linq.EnumerableSorter`1.ComputeMap(TElement[] elements, Int32 count)
at System.Linq.OrderedEnumerable`1.GetEnumerator()+MoveNext()
at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
at Application.Extensions.ThemeExtensions.GetFirstParagraphTheme(PageViewModel page) in C:\actions-runner\_work\musikkens-hus-dynamicweb\musikkens-hus-dynamicweb\Application\Extensions\ThemeExtensions.cs:line 38
at CompiledRazorTemplates.Dynamic.RazorEngine_74c240dfeb324db49ccb805673e42d82.ExecuteAsync()
at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
2 @using Dynamicweb.Frontend;
3 @using Dynamicweb.Content;
4 @using Application.Extensions;
5
6 @{
7 var miscSettings = Model.Area.Item.GetValue<ItemViewModel>("MiscSettings");
8 string searchPageId = Model.Area.Item.GetString("SearchPage");
9 string searchAction = "/Default.aspx?Id=" + searchPageId;
10 string searchFieldPlaceholder = Translate("Translate.Search.Placeholder");
11 string searchAriaLabel = Translate("Translate.Search.Btn");
12 string navigationButtonAriaLabel = Translate("Translate.Navigation.OpenNavigations");
13
14 var navigationSettings = new Dynamicweb.Frontend.Navigation.NavigationSettings()
15 {
16 RootAreaId = Model.Area.ID,
17 RootPageId = 0,
18 StartLevel = 1,
19 StopLevel = 3,
20 ExpandMode = Dynamicweb.Frontend.Navigation.ExpandMode.All
21 };
22
23 List<Dynamicweb.Frontend.PageLanguageViewModel> languages = (List<Dynamicweb.Frontend.PageLanguageViewModel>)Model.Languages;
24
25 int currentPageId = Model.ID;
26 int frontpageId = Model.Area.FirstActivePage.ID;
27
28 string navigationThemeClass = ThemeExtensions.GetFirstParagraphTheme(Model);
29 string navigationMenuCssClass = currentPageId == frontpageId ? "navigation__menu" : "navigation__menu navigation__menu--has-path";
30 string logoLinkTitle = Translate("Translate.Navigation.LogoLinkTitle");
31 }
32
33 <a href="#main" class="skip-to-main">@Translate("Translate.Navigation.SkipToMain")</a>
34 <nav class="navigation @navigationThemeClass" @if (Pageview.IsVisualEditorMode) {<text>style="position: relative !important;"</text> }>
35 @if (Pageview.IsVisualEditorMode)
36 {
37 <div style="width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); z-index: 100; color: #fff; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; font-size: 26px; backdrop-filter: blur(5px)">
38 <p>Navigation is not editable in the Visual editor</p>
39 </div>
40 }
41 <a href="/" class="navigation__logo logo" title="@Translate("Translate.Navigation.LogoLinkTitle")">@FileExtensions.GetFileContentAsHtml($"{FileExtensions.GetDesignPath()}/assets/svg/logo.svg")</a>
42 <div class="navigation__menu-wrap">
43 <ul class="navigation__menu navigation__group navigation__menu-push-left">
44 @Navigation.RenderNavigation("partials/layout/navigation/main.cshtml", navigationSettings)
45 </ul>
46 @if (!string.IsNullOrWhiteSpace(searchPageId)) {
47 <div class="navigation__search" data-search-page-id="@searchPageId">
48 <div class="search__overlay"></div>
49 <form class="search__form" action="@searchAction" autocomplete="off">
50 <input type="hidden" name="Id" value="@searchPageId" />
51 <div class="search__input-wrap navigation__item navigation__item--search-input-wrap">
52 <input id="search-input" class="search__input search__input navigation__item-inner" name="q" type="text" placeholder="@searchFieldPlaceholder" aria-label="@searchAriaLabel" autocomplete="off" required="" />
53 </div>
54 <button class="search__btn navigation__button" aria-label="@searchAriaLabel">@FileExtensions.GetFileContentAsHtml($"{FileExtensions.GetDesignPath()}/assets/svg/search.svg")</button>
55 </form>
56 <label class="search__btn search__btn--toggle navigation__button" for="search-input" aria-label="@searchAriaLabel">@FileExtensions.GetFileContentAsHtml($"{FileExtensions.GetDesignPath()}/assets/svg/search.svg")</label>
57 </div>
58 }
59 @* @if (languages.Count > 1) {
60 <div class="navigation__item navigation__item--language-selector navigation__item--sub navigation__menu-push-left language-selector">
61 <div class="language-selector__current-wrap">
62 <label for="language-selector" class="language-selector__current navigation__item-inner">
63 @foreach (var language in languages)
64 {
65 if (language.IsCurrent)
66 {
67 @language.Culture.Substring(0,2)
68 <span class="navigation__item-sub-icon">
69 @FileExtensions.GetFileContentAsHtml($"{FileExtensions.GetDesignPath()}/assets/svg/arrow.svg")
70 </span>
71 }
72 }
73 </label>
74 <select id="language-selector" class="language-selector__dropdown">
75 @foreach (var language in languages)
76 {
77 if (language.IsCurrent)
78 {
79 <option selected>@language.Culture.Substring(0,2)</option>
80 }
81 else
82 {
83 string languageUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("default.aspx?id=" + language.FirstActivePage.ID);
84
85 PageService ps = new PageService();
86 Page p = ps.GetPage(language.Page.ID);
87
88 if (p != null) {
89 languageUrl = SearchEngineFriendlyURLs.GetFriendlyUrl("default.aspx?id=" + language.Page.ID);
90 }
91
92 <option value="@languageUrl">@language.Culture.Substring(0,2)</option>
93 }
94 }
95 </select>
96 <ul class="language-selector__list">
97 @foreach (var language in languages)
98 {
99 string languageCulture = language.Culture.Substring(0,2);
100
101 if (!language.IsCurrent)
102 {
103 string languageUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("default.aspx?id=" + language.FirstActivePage.ID);
104
105 PageService ps = new PageService();
106 Page p = ps.GetPage(language.Page.ID);
107
108 if (p != null) {
109 languageUrl = SearchEngineFriendlyURLs.GetFriendlyUrl("default.aspx?id=" + language.Page.ID);
110 }
111
112 <li class="language-selector__item">
113 <a href="@languageUrl" class="language-selector__link" title="@languageCulture">@languageCulture</a>
114 </li>
115 }
116 }
117 </ul>
118 </div>
119 </div>
120 } *@
121 @*<a href="#" class="navigation__button navigation__button--login" aria-label="¤DICTIONARY_ITEM">
122 @FileExtensions.GetFileContentAsHtml($"{FileExtensions.GetDesignPath()}/assets/svg/person.svg")
123 </a>*@
124 </div>
125 <button class="navigation__toggle-button navigation__button" aria-label="@navigationButtonAriaLabel">
126 <span class="navigation__toggle-button-icon"></span>
127 </button>
128 </nav>