A massage tailored your needs
Error executing template "Designs/Fjordgaarden/Paragraph/TwoColumnsTextAndList.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_66c07489950b42a689965f964b0c2a3f.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.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String templateSource, 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 @using Dynamicweb.Content
2 @using Dynamicweb.Frontend
3 @using Extensibility.Helpers
4 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
5
6 @{
7 //left
8 var headline = Model.Item.GetString("Headline");
9 var subHeadline = Model.Item.GetString("SubHeadline");
10 var priceComment = Model.Item.GetString("PriceComment");
11 var price = Model.Item.GetString("Price");
12 var globalPrice = Model.Item.GetString("GlobalBox");
13
14 if (!string.IsNullOrEmpty(globalPrice))
15 {
16 var pageService = new PageService();
17 var boxPage = pageService.GetPage(int.Parse(globalPrice));
18 if (boxPage.Item != null)
19 {
20 if (boxPage.ItemType == "Box")
21 {
22 var itemId = boxPage.Item.Id;
23 var item = Dynamicweb.Content.Items.Item.GetItemById(boxPage.ItemType, itemId);
24 price = item["Price"].ToString();
25 }
26 }
27 }
28
29 bool englishArea = Pageview.AreaID != 1;
30
31 if(price.Contains("kr.") && englishArea)
32 {
33 price = price.Replace("kr.", "DKK");
34 }
35
36 var leftText = Model.Item.GetString("LeftText");
37 var topLinksList = Model.Item.GetItems("TopLinksList");
38 var leftButtonList = Model.Item.GetItems("LeftButtonList");
39 var imageListLeft = Model.Item.GetItems("ImageListLeft");
40 var bottomLinksList = Model.Item.GetItems("BottomLinksList");
41 var commentHeadline = Model.Item.GetString("CommentHeadline");
42 var commentText = Model.Item.GetString("CommentText");
43 //right
44 var topText = Model.Item.GetString("TopText");
45 var headlineLinksList = Model.Item.GetItems("HeadlineLinksList");
46 var richText = Model.Item.GetString("RichText");
47 var imageList = Model.Item.GetItems("ImageList");
48 var linkList = Model.Item.GetItems("LinkList");
49 var buttonList = Model.Item.GetItems("RightButtonList");
50 List<IList<ItemViewModel>> popoutList = new List<IList<ItemViewModel>>();
51 var formLink = Model.Item.GetString("FormLink");
52 }
53
54
55
56 <div class="two-columns-text-and-list">
57 <div class="fn-container">
58 <div class="two-columns-text-and-list__left col-lg-7">
59 <div class="two-columns-text-and-list__left__headline dalafloda">@headline</div>
60
61 @if (!string.IsNullOrEmpty(subHeadline))
62 {
63 <div class="two-columns-text-and-list__left__sub-headline">@subHeadline</div>
64 }
65
66 @if (!string.IsNullOrEmpty(leftText))
67 {
68 <div class="two-columns-text-and-list__left__text">@leftText</div>
69 }
70
71 @if (!string.IsNullOrEmpty(priceComment))
72 {
73 <div class="two-columns-text-and-list__left__price-comment">@priceComment</div>
74 }
75
76 @if (!string.IsNullOrEmpty(price))
77 {
78 <div class="two-columns-text-and-list__left__price dalafloda">@price</div>
79 }
80
81 @if (topLinksList != null)
82 {
83 @{
84 popoutList.Add(topLinksList);
85 }
86
87 <div class="two-columns-text-and-list__left__top-links">
88 @foreach (var topLink in topLinksList)
89 {
90 var icon = topLink.GetString("Icon");
91 var text = topLink.GetString("Text");
92 var href = topLink.GetString("Link");
93 var hrefFile = topLink.GetString("LinkFile");
94 var openInNewTab = topLink.GetBoolean("OpenInNewTab");
95 var topLinkPopoutResult = new Popouthelper().PopoutResult(href);
96
97 @if (!string.IsNullOrEmpty(hrefFile))
98 {
99 topLinkPopoutResult = new Popouthelper().PopoutResult(hrefFile);
100 <a @(openInNewTab ? "target=_blank" : "") data-id="@topLinkPopoutResult.pageId" class="two-columns-text-and-list__left__top-links__top-link text-decoration-none d-inline-block text-decoration-none text-uppercase @topLinkPopoutResult.className" href="@topLinkPopoutResult.href">
101 @if (!string.IsNullOrEmpty(icon))
102 {
103 <img loading="lazy" class="icon icon--black " alt="icon" src="@icon" />
104 }
105
106 <span class="fn-link">@text</span>
107
108 </a>
109 }
110 else
111 {
112 <a @(openInNewTab ? "target=_blank" : "") data-id="@topLinkPopoutResult.pageId" class="two-columns-text-and-list__left__top-links__top-link text-decoration-none d-inline-block text-decoration-none text-uppercase @topLinkPopoutResult.className" href="@topLinkPopoutResult.href">
113 @if (!string.IsNullOrEmpty(icon))
114 {
115 <img loading="lazy" class="icon icon--black " alt="icon" src="@icon" />
116 }
117
118 <span class="fn-link">@text</span>
119 </a>
120 }
121 }
122 </div>
123 }
124
125 @if (leftButtonList != null)
126 {
127 <div class="two-columns-text-and-list__left__left-buttons flex-wrap">
128
129 @{
130 popoutList.Add(leftButtonList);
131 }
132
133 @foreach (var leftButton in leftButtonList)
134 {
135 var text = leftButton.GetString("Text");
136 var icon = leftButton.GetString("Icon");
137 var href = leftButton.GetString("Link");
138 var hrefFile = leftButton.GetString("LinkFile");
139 var openInNewTab = leftButton.GetBoolean("OpenInNewTab");
140 var buttonPopout = new Popouthelper().PopoutResult(href);
141
142 @if (!string.IsNullOrEmpty(hrefFile))
143 {
144 buttonPopout = new Popouthelper().PopoutResult(hrefFile);
145 <a @(openInNewTab ? "target='blank'" : "") data-id="@buttonPopout.pageId" class="text-decoration-none @buttonPopout.className" href="@buttonPopout.href">
146 <div class="two-columns-text-and-list__left__left-buttons__left-button fn-button fn-button--blue w-100 d-flex justify-content-center">
147 <div class="two-columns-text-and-list__left__left-buttons__left-button__container d-flex align-items-center">
148
149 @if (!string.IsNullOrEmpty(icon))
150 {
151 <img loading="lazy" class="icon icon--black me-2" alt="icon" src="@icon" />
152 }
153
154 @text
155 </div>
156 </div>
157 </a>
158 }
159 else
160 {
161 <a @(openInNewTab ? "target='blank'" : "") data-id="@buttonPopout.pageId" class="text-decoration-none @buttonPopout.className" href="@buttonPopout.href">
162 <div class="two-columns-text-and-list__left__left-buttons__left-button fn-button fn-button--blue w-100 d-flex justify-content-center">
163 <div class="two-columns-text-and-list__left__left-buttons__left-button__container d-flex align-items-center">
164
165 @if (!string.IsNullOrEmpty(icon))
166 {
167 <img loading="lazy" class="icon icon--black me-2" alt="icon" src="@icon" />
168 }
169
170 @text
171 </div>
172 </div>
173 </a>
174 }
175 }
176 </div>
177 }
178
179 @if (imageListLeft != null)
180 {
181 <div class="two-columns-text-and-list__right__images d-flex align-items-center justify-content-evenly flex-wrap">
182 @foreach (var image in imageListLeft)
183 {
184 <a target=_blank href="@image.GetString("Link")">
185 <img loading="lazy" class="two-columns-text-and-list__right__images__image" src=" @image.GetString("Image")" alt="@image.GetString("Alt")"></img>
186 </a>
187 }
188 </div>
189 }
190
191 @if (bottomLinksList != null)
192 {
193 @{
194 popoutList.Add(bottomLinksList);
195 }
196
197 <div class="two-columns-text-and-list__left__top-links">
198 @foreach (var bottomLink in bottomLinksList)
199 {
200 var icon = bottomLink.GetString("Icon");
201 var text = bottomLink.GetString("Text");
202 var href = bottomLink.GetString("Link");
203 var hrefFile = bottomLink.GetString("LinkFile");
204 var openInNewTab = bottomLink.GetBoolean("OpenInNewTab");
205 var bottomLinkPopoutResult = new Popouthelper().PopoutResult(href);
206
207 @if (!string.IsNullOrEmpty(hrefFile))
208 {
209 bottomLinkPopoutResult = new Popouthelper().PopoutResult(hrefFile);
210 <a @(openInNewTab ? "target=_blank" : "") data-id="@bottomLinkPopoutResult.pageId" class="two-columns-text-and-list__left__top-links__top-link text-decoration-none d-inline-block text-decoration-none text-uppercase @bottomLinkPopoutResult.className" href="@bottomLinkPopoutResult.href">
211 @if (!string.IsNullOrEmpty(icon))
212 {
213 <img loading="lazy" class="icon icon--black " alt="icon" src="@icon" />
214 }
215
216 <span class="fn-link">@text</span>
217 </a>
218 }
219 else
220 {
221 <a @(openInNewTab ? "target=_blank" : "") data-id="@bottomLinkPopoutResult.pageId" class="two-columns-text-and-list__left__top-links__top-link text-decoration-none d-inline-block text-decoration-none text-uppercase @bottomLinkPopoutResult.className" href="@bottomLinkPopoutResult.href">
222 @if (!string.IsNullOrEmpty(icon))
223 {
224 <img loading="lazy" class="icon icon--black " alt="icon" src="@icon" />
225 }
226
227 <span class="fn-link">@text</span>
228 </a>
229 }
230 }
231 </div>
232 }
233
234 <div class="two-columns-text-and-list__left__comment-headline">@commentHeadline</div>
235 @commentText
236 </div>
237
238
239 <!-- Right -->
240
241
242 <div class="two-columns-text-and-list__right col-lg-5">
243 @topText
244 <div class="two-columns-text-and-list__right__headline-links">
245 @foreach (var headlineLinks in headlineLinksList)
246 {
247 bool twoColumns = headlineLinks.GetItems("FooterLinkList").Count() > 10;
248
249 <div class="two-columns-text-and-list__right__headline-links__headline">@headlineLinks.GetString("Headline")</div>
250 <div class="two-columns-text-and-list__right__headline-links__links @(twoColumns ? "two-columns" : "")">
251
252 @{
253 var links = headlineLinks.GetItems("FooterLinkList");
254 var firstHalf = links.Take(links.Count / 2);
255 var secondHalf = links.Skip(links.Count / 2);
256 }
257
258 @if (twoColumns)
259 {
260 <div class="d-flex flex-column col-6">
261 @foreach (var link in firstHalf)
262 {
263 var href = link.GetString("Link");
264 var hrefFile = link.GetString("LinkFile");
265 var openInNewTab = link.GetBoolean("OpenInNewTab");
266 var icon = @link.GetString("Icon");
267 var text = @link.GetString("Text");
268
269 if (!string.IsNullOrEmpty(hrefFile))
270 {
271 <a @(openInNewTab ? "target=_blank" : "") class="two-columns-text-and-list__right__headline-links__links__link text-decoration-none d-flex align-items-center w-100 @(string.IsNullOrEmpty(link.GetString("LinkFile")) ? "" : "underline")" @(string.IsNullOrEmpty(link.GetString("LinkFile")) ? "" : "href=")@hrefFile>
272 @if (!string.IsNullOrEmpty(icon))
273 {
274 <img loading="lazy" class="two-columns-text-and-list__right__headline-links__links__link__icon icon icon--grey icon--big me-3" src="@icon" />
275 }
276 <p class="two-columns-text-and-list__right__headline-links__links__link__text d-inline">@text</p>
277 </a>
278 }
279 else
280 {
281 <a @(openInNewTab ? "target=_blank" : "") class="two-columns-text-and-list__right__headline-links__links__link text-decoration-none d-flex align-items-center w-100 @(string.IsNullOrEmpty(link.GetString("Link")) ? "" : "underline")" @(string.IsNullOrEmpty(link.GetString("Link")) ? "" : "href=")@href>
282 @if (!string.IsNullOrEmpty(icon))
283 {
284 <img loading="lazy" class="two-columns-text-and-list__right__headline-links__links__link__icon icon icon--grey icon--big me-3" src="@icon" />
285 }
286 <p class="two-columns-text-and-list__right__headline-links__links__link__text d-inline">@text</p>
287 </a>
288 }
289
290
291 }
292 </div>
293 <div class="d-flex flex-column col-6">
294 @foreach (var link in secondHalf)
295 {
296 var href = link.GetString("Link");
297 var hrefFile = link.GetString("LinkFile");
298 var openInNewTab = link.GetBoolean("OpenInNewTab");
299 var icon = @link.GetString("Icon");
300 var text = @link.GetString("Text");
301
302 if (!string.IsNullOrEmpty(hrefFile))
303 {
304 <a @(openInNewTab ? "target=_blank" : "") class="two-columns-text-and-list__right__headline-links__links__link text-decoration-none d-flex align-items-center w-100 @(string.IsNullOrEmpty(link.GetString("LinkFile")) ? "" : "underline")" @(string.IsNullOrEmpty(link.GetString("LinkFile")) ? "" : "href=")@hrefFile>
305 @if (!string.IsNullOrEmpty(icon))
306 {
307 <img loading="lazy" class="two-columns-text-and-list__right__headline-links__links__link__icon icon icon--grey icon--big me-3" src="@icon" />
308 }
309 <p class="two-columns-text-and-list__right__headline-links__links__link__text d-inline">@text</p>
310 </a>
311 }
312 else
313 {
314 <a @(openInNewTab ? "target=_blank" : "") class="two-columns-text-and-list__right__headline-links__links__link text-decoration-none d-flex align-items-center w-100 @(string.IsNullOrEmpty(link.GetString("Link")) ? "" : "underline")" @(string.IsNullOrEmpty(link.GetString("Link")) ? "" : "href=")@href>
315 @if (!string.IsNullOrEmpty(icon))
316 {
317 <img loading="lazy" class="two-columns-text-and-list__right__headline-links__links__link__icon icon icon--grey icon--big me-3" src="@icon" />
318 }
319 <p class="two-columns-text-and-list__right__headline-links__links__link__text d-inline">@text</p>
320 </a>
321 }
322 }
323 </div>
324 }
325 else
326 {
327 <div class="d-flex flex-column col-12">
328 @foreach (var link in links)
329 {
330 var href = link.GetString("Link");
331 var hrefFile = link.GetString("LinkFile");
332 var openInNewTab = link.GetBoolean("OpenInNewTab");
333 var icon = @link.GetString("Icon");
334 var text = @link.GetString("Text");
335
336 if (!string.IsNullOrEmpty(hrefFile))
337 {
338 <a @(openInNewTab ? "target=_blank" : "") class="two-columns-text-and-list__right__headline-links__links__link text-decoration-none d-flex align-items-center w-100 @(string.IsNullOrEmpty(link.GetString("LinkFile")) ? "" : "underline")" @(string.IsNullOrEmpty(link.GetString("LinkFile")) ? "" : "href=")@hrefFile>
339 @if (!string.IsNullOrEmpty(icon))
340 {
341 <img loading="lazy" class="two-columns-text-and-list__right__headline-links__links__link__icon icon icon--grey icon--big me-3" src="@icon" />
342 }
343 <p class="two-columns-text-and-list__right__headline-links__links__link__text d-inline">@text</p>
344 </a>
345 }
346 else
347 {
348 <a @(openInNewTab ? "target=_blank" : "") class="two-columns-text-and-list__right__headline-links__links__link text-decoration-none d-flex align-items-center w-100 @(string.IsNullOrEmpty(link.GetString("Link")) ? "" : "underline")" @(string.IsNullOrEmpty(link.GetString("Link")) ? "" : "href=")@href>
349 @if (!string.IsNullOrEmpty(icon))
350 {
351 <img loading="lazy" class="two-columns-text-and-list__right__headline-links__links__link__icon icon icon--grey icon--big me-3" src="@icon" />
352 }
353 <p class="two-columns-text-and-list__right__headline-links__links__link__text d-inline">@text</p>
354 </a>
355 }
356 }
357 </div>
358 }
359
360 </div>
361 }
362 </div>
363 @if (!string.IsNullOrEmpty(formLink))
364 {
365 <div class="two-columns-text-and-list__right__form">
366 @RenderParagraphContent(int.Parse(formLink))
367 </div>
368 }
369 @richText
370 @if (imageList != null)
371 {
372 <div class="two-columns-text-and-list__right__images d-flex align-items-center justify-content-evenly flex-wrap">
373 @foreach (var image in imageList)
374 {
375 <a target=_blank href="@image.GetString("Link")">
376 <img loading="lazy" class="two-columns-text-and-list__right__images__image" src=" @image.GetString("Image")" alt="@image.GetString("Alt")"></img>
377 </a>
378 }
379 </div>
380 }
381
382 @if (linkList != null)
383 {
384 @{
385 popoutList.Add(linkList);
386 }
387
388 <div class="two-columns-text-and-list__left__top-links">
389 @foreach (var bottomLink in linkList)
390 {
391 var icon = bottomLink.GetString("Icon");
392 var text = bottomLink.GetString("Text");
393 var href = bottomLink.GetString("Link");
394 var hrefFile = bottomLink.GetString("LinkFile");
395 var openInNewTab = bottomLink.GetBoolean("OpenInNewTab");
396 var bottomLinkPopoutResult = new Popouthelper().PopoutResult(href);
397
398 @if (!string.IsNullOrEmpty(hrefFile))
399 {
400 bottomLinkPopoutResult = new Popouthelper().PopoutResult(hrefFile);
401 <a @(openInNewTab ? "target=_blank" : "") data-id="@bottomLinkPopoutResult.pageId" class="two-columns-text-and-list__left__top-links__top-link text-decoration-none d-inline-block text-decoration-none text-uppercase @bottomLinkPopoutResult.className" href="@bottomLinkPopoutResult.href">
402 @if (!string.IsNullOrEmpty(icon))
403 {
404 <img loading="lazy" class="icon icon--black " alt="icon" src="@icon" />
405 }
406
407 <span class="fn-link">@text</span>
408 </a>
409 }
410 else
411 {
412 <a @(openInNewTab ? "target=_blank" : "") data-id="@bottomLinkPopoutResult.pageId" class="two-columns-text-and-list__left__top-links__top-link text-decoration-none d-inline-block text-decoration-none text-uppercase @bottomLinkPopoutResult.className" href="@bottomLinkPopoutResult.href">
413 @if (!string.IsNullOrEmpty(icon))
414 {
415 <img loading="lazy" class="icon icon--black " alt="icon" src="@icon" />
416 }
417
418 <span class="fn-link">@text</span>
419 </a>
420 }
421 }
422 </div>
423 }
424
425 @if (buttonList != null)
426 {
427 <div class="two-columns-text-and-list__left__left-buttons flex-wrap">
428
429 @{
430 popoutList.Add(buttonList);
431 }
432
433 @foreach (var rightButton in buttonList)
434 {
435 var text = rightButton.GetString("Text");
436 var icon = rightButton.GetString("Icon");
437 var href = rightButton.GetString("Link");
438 var hrefFile = rightButton.GetString("LinkFile");
439 var openInNewTab = rightButton.GetBoolean("OpenInNewTab");
440 var buttonPopout = new Popouthelper().PopoutResult(href);
441
442 @if (!string.IsNullOrEmpty(hrefFile))
443 {
444 buttonPopout = new Popouthelper().PopoutResult(hrefFile);
445 <a @(openInNewTab ? "target='blank'" : "") data-id="@buttonPopout.pageId" class="text-decoration-none @buttonPopout.className" href="@buttonPopout.href">
446 <div class="two-columns-text-and-list__left__left-buttons__left-button fn-button fn-button--blue w-100 d-flex justify-content-center">
447 <div class="two-columns-text-and-list__left__left-buttons__left-button__container d-flex align-items-center">
448
449 @if (!string.IsNullOrEmpty(icon))
450 {
451 <img loading="lazy" class="icon icon--black me-2" alt="icon" src="@icon" />
452 }
453
454 @text
455 </div>
456 </div>
457 </a>
458 }
459 else
460 {
461 <a @(openInNewTab ? "target='blank'" : "") data-id="@buttonPopout.pageId" class="text-decoration-none @buttonPopout.className" href="@buttonPopout.href">
462 <div class="two-columns-text-and-list__left__left-buttons__left-button fn-button fn-button--blue w-100 d-flex justify-content-center">
463 <div class="two-columns-text-and-list__left__left-buttons__left-button__container d-flex align-items-center">
464
465 @if (!string.IsNullOrEmpty(icon))
466 {
467 <img loading="lazy" class="icon icon--black me-2" alt="icon" src="@icon" />
468 }
469
470 @text
471 </div>
472 </div>
473 </a>
474 }
475 }
476 </div>
477 }
478
479
480
481 </div>
482 </div>
483 </div>
484
485 @{
486 Dictionary<string, object> parameters = new Dictionary<string, object>();
487 parameters.Add("popOuts", popoutList);
488 @RenderPartial("../partials/Popout.cshtml", Model, parameters)
489 }