Error executing template "Designs/Danespo/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_66380ace1a8b4e9fac1bc18c34239dd8.Execute() in D:\Sites\danespoDW\Application_9.7.4\Files\Templates\Designs\Danespo\_parsed\News.parsed.cshtml:line 285
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using System; 2 @using System.Web; 3 @using Dynamicweb; 4 @using Dynamicweb.Environment; 5 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 6 @using Dynamicweb; 7 8 @helper RenderFacebookScript() 9 { 10 <div id="fb-root"></div> 11 <script> 12 (function (d, s, id) { 13 var js, fjs = d.getElementsByTagName(s)[0]; 14 if (d.getElementById(id)) return; 15 js = d.createElement(s); js.id = id; 16 js.src = "//connect.facebook.net/da_DK/sdk.js#xfbml=1&version=v2.8"; 17 fjs.parentNode.insertBefore(js, fjs); 18 }(document, 'script', 'facebook-jssdk'));</script> 19 } 20 @using Dynamicweb; 21 @helper RenderFacebookShare() 22 { 23 bool sharePageFB = GetBoolean("Item.Page.SharePageOnFacebook"); 24 var pageViewUrlForSharing = Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain() + Pageview.SearchFriendlyUrl; 25 26 if (sharePageFB) 27 { 28 <div class="fb-share-button" data-href='@pageViewUrlForSharing' data-layout="button" data-size="small" data-mobile-iframe="true"><a class="fb-xfbml-parse-ignore" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&amp;src=sdkpreparse">Del</a></div> 29 } 30 } 31 32 @SnippetStart("Meta") 33 @{ 34 string sharePageImage = Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain() + GetString("Item.Page.ImageForSharing"); 35 string title = GetString("Title"); 36 string description = GetString("Meta.Description"); 37 var pageViewUrlForSharing = Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain() + Pageview.SearchFriendlyUrl; 38 39 <meta property="fb:app_id" content="966242223397117"> /* default facebook app-id */ 40 <meta property="og:title" content='@title'> 41 <meta property="og:type" content="article"> 42 if (!string.IsNullOrEmpty(GetString("Item.Page.ImageForSharing"))) 43 { 44 <meta property="og:image" content='@sharePageImage'> 45 } 46 <meta property="og:url" content='@pageViewUrlForSharing'> 47 <meta property="og:description" content="@description"> 48 } 49 @SnippetEnd("Meta") 50 @{ 51 var designBaseUrl = GetString("Template:DesignBaseUrl").TrimEnd('/'); 52 List<LoopItem> languages = GetLoop("WebsiteLanguages"); 53 54 bool isAlternativeSite = GetBoolean("Item.Area.IsAlternativeSite"); 55 string languageTag = GetGlobalValue("Global:Area.Lang").ToLower(); 56 } 57 <!DOCTYPE html> 58 <html lang="@languageTag"> 59 <head> 60 <title>@GetValue("Title")</title> 61 @GetValue("MetaTags") 62 @GetValue("CopyRightNotice") 63 64 <meta charset="utf-8"> 65 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> 66 <meta http-equiv="x-ua-compatible" content="ie=edge"> 67 @RenderSnippet("Meta") 68 <link rel="stylesheet" href="@designBaseUrl/Assets/Styles/Main.min.css?v.2.14"> 69 <link rel="stylesheet" href="@designBaseUrl/Assets/Styles/co3-custom.css?v=1.02"> 70 @RenderSnippet("Styling") 71 72 @{ 73 string alternativeColor = Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["AlternativeColor"]); 74 75 if (!string.IsNullOrEmpty(alternativeColor)) 76 { 77 <style type="text/css"> 78 .content-row-wrapper .content-row-content-wrapper .content-row-content.style2 .content-row-link-alternative { 79 background-color: @alternativeColor; 80 } 81 </style> 82 } 83 } 84 85 <!-- Google Tag Manager --> 86 <script> 87 (function (w, d, s, l, i) { 88 w[l] = w[l] || []; w[l].push( 89 { 'gtm.start': new Date().getTime(), event: 'gtm.js' } 90 ); var f = d.getElementsByTagName(s)[0], 91 j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = 92 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); 93 })(window, document, 'script', 'dataLayer', 'GTM-NWHDKFK'); 94 </script> 95 <!-- End Google Tag Manager --> 96 @GetValue("Stylesheets") 97 @GetValue("Javascripts") 98 </head> 99 <body> 100 <!-- Google Tag Manager (noscript) --> 101 <noscript> 102 <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NWHDKFK" height="0" width="0" style="display:none;visibility:hidden"></iframe> 103 </noscript> 104 <!-- End Google Tag Manager (noscript) --> 105 <div class="wrapper"> 106 <div class="page"> 107 108 <header class="header"> 109 <div class="header-topline hidden-sm-down"> 110 <div class="container"> 111 <div class="row"> 112 <div class="col-md-12 header-tabs"> 113 @if (languageTag == "da") 114 { 115 if (isAlternativeSite) 116 { 117 <span class="tab active-tab">@Translate("Smartpage:Header.Sites.Site1", "Forbruger")</span> 118 <a href='@GetValue("Item.Area.AlternativeSite")' class="tab ">@Translate("Smartpage:Header.Sites.Site2", "Erhverv")</a> 119 } 120 else 121 { 122 <a href='@GetValue("Item.Area.AlternativeSite")' class="tab">@Translate("Smartpage:Header.Sites.Site1", "Forbruger")</a> 123 <span class="tab active-tab">@Translate("Smartpage:Header.Sites.Site2", "Erhverv")</span> 124 } 125 } 126 127 128 </div> 129 <div class="col-md-12 header-lang-select"> 130 @if (languages.Any() && Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["LanguageActive"]) == "True") 131 { 132 <div class="dropdown"> 133 <button class="dropdown-button" type="button" id="desktopLangSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 134 @languages.FirstOrDefault(l => l.GetBoolean("IsCurrent")).GetString("Name") 135 </button> 136 <div class="dropdown-menu" aria-labelledby="desktopLangSelect"> 137 @foreach (var language in languages) 138 { 139 string url = "https://www.danespo.dk/Default.aspx?id=" + language.GetValue("FirstPageID"); //for pretty urls 140 string isMaster = language.GetBoolean("IsMaster") ? "js-langmaster" : ""; 141 int areaId = language.GetInteger("ID"); 142 bool isActive = Dynamicweb.Services.Areas.GetArea(areaId).Active; 143 string inactiveClass = ""; 144 if (!isActive) 145 { 146 inactiveClass = "hidden-xl-down"; 147 } 148 149 <a href="@url" class="dropdown-item @isMaster @inactiveClass"> 150 @language.GetValue("Name") 151 </a> 152 } 153 </div> 154 </div> 155 } 156 </div> 157 </div> 158 </div> 159 </div> 160 161 <div class="header-topbar"> 162 <div class="container"> 163 <div class="row"> 164 <div class="col-xs-18 col-sm-8 col-md-3 col-lg-3 header-logo"> 165 <a href='@GetValue("Item.Area.SiteFrontpage")' class="header-logo-link"> 166 <img src='@Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["Logo"])' class="img-fluid hidden-md-up" alt='@Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["SiteName"])'> 167 <img src='@Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["LogoLarge"])' class="img-fluid hidden-sm-down" alt='@Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["SiteName"])'> 168 </a> 169 </div> 170 171 <div class="col-xs-6 col-sm-16 hidden-md-up header-hamburger"> 172 <button class="hamburger hamburger--slider js-navigation-toggle" type="button"> 173 <span class="hamburger-box"> 174 <span class="hamburger-inner"></span> 175 </span> 176 </button> 177 </div> 178 179 <div class="col-xs-24 col-sm-24 col-md-21 col-lg-21 header-navigation"> 180 <div class="navigation js-navigation"> 181 182 <div class="header-topline hidden-md-up"> 183 <div class="container"> 184 <div class="row"> 185 <div class="col-xs-14 header-tabs"> 186 @if (isAlternativeSite) 187 { 188 <span class="tab active-tab">@Translate("Smartpage:Header.Sites.Site1", "Forbruger")</span> 189 <a href='@GetValue("Item.Area.AlternativeSite")' class="tab ">@Translate("Smartpage:Header.Sites.Site2", "Erhverv")</a> 190 } 191 else 192 { 193 <a href='@GetValue("Item.Area.AlternativeSite")' class="tab">@Translate("Smartpage:Header.Sites.Site1", "Forbruger")</a> 194 <span class="tab active-tab">@Translate("Smartpage:Header.Sites.Site2", "Erhverv")</span> 195 } 196 </div> 197 <div class="col-xs-10 header-lang-select"> 198 @if (languages.Any() && !isAlternativeSite) 199 { 200 <div class="dropdown"> 201 <button class="dropdown-button" type="button" id="mobileLangSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 202 @languages.FirstOrDefault(l => l.GetBoolean("IsCurrent")).GetString("Name") 203 </button> 204 <div class="dropdown-menu" aria-labelledby="mobileLangSelect"> 205 @foreach (var language in languages) 206 { 207 <a href='/Default.aspx?id=@language.GetValue("FirstPageID")' class="dropdown-item"> 208 @language.GetValue("Name") 209 </a> 210 } 211 </div> 212 </div> 213 } 214 </div> 215 </div> 216 </div> 217 </div> 218 219 <div class="navigation-wrap"> 220 @GetValue("DwNavigation(mainnavigation)") 221 </div> 222 223 </div> 224 </div> 225 226 </div> 227 </div> 228 229 </div> 230 </header> 231 232 <div class="content-wrapper"> 233 @using System; 234 @using System.Web; 235 @using System.Linq; 236 @using Dynamicweb; 237 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 238 @{ 239 string topbanner = GetString( "DwContent(TopBanner)" ); 240 string topbannerCheck = ""; 241 if ( topbanner != "") { 242 topbannerCheck = "topbanner-active"; 243 } 244 } 245 246 247 @using System; 248 @using System.Web; 249 @using Dynamicweb; 250 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 251 252 @helper RenderBreadcrumbs() 253 { 254 255 if ((Pageview.Page.PropertyItem != null && Dynamicweb.Core.Converter.ToBoolean(Pageview.Page.PropertyItem["ShowBreadcrumbsOnPage"])) && Dynamicweb.Core.Converter.ToBoolean(Pageview.Area.Item["ShowBreadcrumbsOnWebsite"])) 256 { 257 @GetValue("DwNavigation(mainbreadcrumbs)") 258 } 259 } 260 <div class="topbanner-carousel" id="TopBanner">@GetValue("DwContent(TopBanner)")</div> 261 <div class="container @topbannerCheck"> 262 @RenderFacebookShare() 263 264 <div class="row page-row"> 265 <div class="col-xs-24 col-sm-24 col-md-16 col-lg-18"> 266 267 <div class="page-content"> 268 <ul class="breadcrumbs" itemscope="" itemtype="http://schema.org/ListItem"> 269 @RenderBreadcrumbs() 270 271 </ul> 272 <div id="content">@GetValue("DwContent(content)")</div> 273 274 </div> 275 </div> 276 <div class="col-xs-24 col-sm-24 col-md-8 col-lg-6"> 277 <div class="page-side" id="side">@GetValue("DwContent(side)")</div> 278 </div> 279 </div> 280 </div> 281 282 283 @SnippetStart("Styling") 284 @{ 285 string backgroundImagePath = Dynamicweb.Core.Converter.ToString(Pageview.Page.PropertyItem["BackgroundImage"]); 286 string backgroundImage = "url('" + backgroundImagePath + "')"; 287 } 288 @if (!string.IsNullOrEmpty(backgroundImagePath)) 289 { 290 <style type="text/css"> 291 body { 292 background-image: @backgroundImage; 293 } 294 </style> 295 } 296 @SnippetEnd("Styling") 297 </div> 298 299 </div> 300 301 </div> 302 303 <footer class="footer"> 304 <div class="container"> 305 <div class="row"> 306 <div class="col-xs-24 col-sm-24 col-md-6"> 307 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["Footer_Col_1"]))) 308 { 309 @Pageview.Area.Item["Footer_Col_1"] 310 } else { 311 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.CompanyName", "Danespo A/S")</h4> 312 <ul class="list"> 313 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyAddress"]))) 314 { 315 <li class="list-item">@Pageview.Area.Item["CompanyAddress"]</li> 316 } 317 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyPhone"]))) 318 { 319 <li class="list-item">@Translate("Smartpage:Footer.CompanyInfo.Phone", "Telefon:") @Pageview.Area.Item["CompanyPhone"]</li> 320 } 321 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyEmail"]))) 322 { 323 <li class="list-item">@Translate("Smartpage:Footer.CompanyInfo.Email", "Email:") @Pageview.Area.Item["CompanyEmail"]</li> 324 } 325 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyNo"]))) 326 { 327 <li class="list-item">@Translate("Smartpage:Footer.CompanyInfo.CompanyNo", "CVR nr.") @Pageview.Area.Item["CompanyNo"]</li> 328 } 329 </ul> 330 } 331 </div> 332 <div class="col-xs-24 col-sm-24 col-md-6"> 333 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["Footer_Col_2"]))) 334 { 335 @Pageview.Area.Item["Footer_Col_2"] 336 } else { 337 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.Production", "Produktion")</h4> 338 @GetValue("DwNavigation(footerlist1)") 339 } 340 </div> 341 <div class="col-xs-24 col-sm-24 col-md-6"> 342 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["Footer_Col_3"]))) 343 { 344 @Pageview.Area.Item["Footer_Col_3"] 345 } else { 346 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.Profile", "Om os")</h4> 347 @GetValue("DwNavigation(footerlist2)") 348 } 349 </div> 350 <div class="col-xs-24 col-sm-24 col-md-6"> 351 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["Footer_Col_4"]))) 352 { 353 @Pageview.Area.Item["Footer_Col_4"] 354 } else { 355 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.Links", "Links")</h4> 356 <ul class="list inline"> 357 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["FacebookLink"]))) 358 { 359 <li class="list-item"> 360 <a href='@Pageview.Area.Item["FacebookLink"]' target="_blank" class="list-item-link facebook"></a> 361 </li> 362 } 363 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["SmileyLink"]))) 364 { 365 string smileyLink = Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["SmileyLink"]); 366 <li class="list-item"> 367 <a href="@smileyLink" target="_blank" class="list-item-link smiley"></a> 368 </li> 369 } 370 </ul> 371 } 372 </div> 373 </div> 374 </div> 375 </footer> 376 377 <script> 378 (function (d) { 379 var config = { 380 kitId: 'znw6ggx', 381 scriptTimeout: 3000, 382 async: true 383 }, 384 h = d.documentElement, t = setTimeout(function () { h.className = h.className.replace(/\bwf-loading\b/g, "") + " wf-inactive"; }, config.scriptTimeout), tk = d.createElement("script"), f = false, s = d.getElementsByTagName("script")[0], a; h.className += " wf-loading"; tk.src = 'https://use.typekit.net/' + config.kitId + '.js'; tk.async = true; tk.onload = tk.onreadystatechange = function () { a = this.readyState; if (f || a && a != "complete" && a != "loaded") return; f = true; clearTimeout(t); try { Typekit.load(config) } catch (e) { } }; s.parentNode.insertBefore(tk, s) 385 })(document); 386 </script> 387 388 <script src='@designBaseUrl/Assets/Scripts/Main.min.js?v.1.6'></script> 389 @RenderSnippet("JavaScript") 390 <div id="fb-root"></div> 391 <script> 392 (function (d, s, id) { 393 var js, fjs = d.getElementsByTagName(s)[0]; 394 if (d.getElementById(id)) return; 395 js = d.createElement(s); js.id = id; 396 js.src = "//connect.facebook.net/da_DK/sdk.js#xfbml=1&version=v2.8"; 397 fjs.parentNode.insertBefore(js, fjs); 398 }(document, 'script', 'facebook-jssdk'));</script> 399 400 </body> 401 </html> 402