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_6e6fe833262c4a689ee8736201861080.Execute() in D:\Sites\danespoDW\Application_9.7.4\Files\Templates\Designs\Danespo\_parsed\Page.parsed.cshtml:line 272
   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.01"> 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 = "/Default.aspx?id=" + language.GetValue("FirstPageID"); //for pretty urls 140 string isMaster = language.GetBoolean("IsMaster") ? "js-langmaster" : ""; 141 142 <a href="@url" class="dropdown-item @isMaster"> 143 @language.GetValue("Name") 144 </a> 145 } 146 </div> 147 </div> 148 } 149 </div> 150 </div> 151 </div> 152 </div> 153 154 <div class="header-topbar"> 155 <div class="container"> 156 <div class="row"> 157 <div class="col-xs-18 col-sm-8 col-md-3 col-lg-3 header-logo"> 158 <a href='@GetValue("Item.Area.SiteFrontpage")' class="header-logo-link"> 159 <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"])'> 160 <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"])'> 161 </a> 162 </div> 163 164 <div class="col-xs-6 col-sm-16 hidden-md-up header-hamburger"> 165 <button class="hamburger hamburger--slider js-navigation-toggle" type="button"> 166 <span class="hamburger-box"> 167 <span class="hamburger-inner"></span> 168 </span> 169 </button> 170 </div> 171 172 <div class="col-xs-24 col-sm-24 col-md-21 col-lg-21 header-navigation"> 173 <div class="navigation js-navigation"> 174 175 <div class="header-topline hidden-md-up"> 176 <div class="container"> 177 <div class="row"> 178 <div class="col-xs-14 header-tabs"> 179 @if (isAlternativeSite) 180 { 181 <span class="tab active-tab">@Translate("Smartpage:Header.Sites.Site1", "Forbruger")</span> 182 <a href='@GetValue("Item.Area.AlternativeSite")' class="tab ">@Translate("Smartpage:Header.Sites.Site2", "Erhverv")</a> 183 } 184 else 185 { 186 <a href='@GetValue("Item.Area.AlternativeSite")' class="tab">@Translate("Smartpage:Header.Sites.Site1", "Forbruger")</a> 187 <span class="tab active-tab">@Translate("Smartpage:Header.Sites.Site2", "Erhverv")</span> 188 } 189 </div> 190 <div class="col-xs-10 header-lang-select"> 191 @if (languages.Any() && !isAlternativeSite) 192 { 193 <div class="dropdown"> 194 <button class="dropdown-button" type="button" id="mobileLangSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 195 @languages.FirstOrDefault(l => l.GetBoolean("IsCurrent")).GetString("Name") 196 </button> 197 <div class="dropdown-menu" aria-labelledby="mobileLangSelect"> 198 @foreach (var language in languages) 199 { 200 <a href='/Default.aspx?id=@language.GetValue("FirstPageID")' class="dropdown-item"> 201 @language.GetValue("Name") 202 </a> 203 } 204 </div> 205 </div> 206 } 207 </div> 208 </div> 209 </div> 210 </div> 211 212 <div class="navigation-wrap"> 213 @GetValue("DwNavigation(mainnavigation)") 214 </div> 215 216 </div> 217 </div> 218 219 </div> 220 </div> 221 222 </div> 223 </header> 224 225 <div class="content-wrapper"> 226 @using System; 227 @using System.Web; 228 @using System.Linq; 229 @using Dynamicweb; 230 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 231 232 233 234 @using System; 235 @using System.Web; 236 @using Dynamicweb; 237 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 238 239 @helper RenderBreadcrumbs() 240 { 241 242 if ((Pageview.Page.PropertyItem != null && Dynamicweb.Core.Converter.ToBoolean(Pageview.Page.PropertyItem["ShowBreadcrumbsOnPage"])) && Dynamicweb.Core.Converter.ToBoolean(Pageview.Area.Item["ShowBreadcrumbsOnWebsite"])) 243 { 244 @GetValue("DwNavigation(mainbreadcrumbs)") 245 } 246 } 247 248 <div class="container"> 249 @RenderFacebookShare() 250 251 <div class="row page-row"> 252 <div class="col-xs-24 col-sm-24 col-md-16 col-lg-18"> 253 254 <div class="page-content"> 255 <ul class="breadcrumbs" itemscope="" itemtype="http://schema.org/ListItem"> 256 @RenderBreadcrumbs() 257 258 </ul> 259 <div id="content">@GetValue("DwContent(content)")</div> 260 261 </div> 262 </div> 263 <div class="col-xs-24 col-sm-24 col-md-8 col-lg-6"> 264 <div class="page-side" id="side">@GetValue("DwContent(side)")</div> 265 </div> 266 </div> 267 </div> 268 269 270 @SnippetStart("Styling") 271 @{ 272 string backgroundImagePath = Dynamicweb.Core.Converter.ToString(Pageview.Page.PropertyItem["BackgroundImage"]); 273 string backgroundImage = "url('" + backgroundImagePath + "')"; 274 } 275 @if (!string.IsNullOrEmpty(backgroundImagePath)) 276 { 277 <style type="text/css"> 278 body { 279 background-image: @backgroundImage; 280 } 281 </style> 282 } 283 @SnippetEnd("Styling") 284 </div> 285 286 </div> 287 288 </div> 289 290 <footer class="footer"> 291 <div class="container"> 292 <div class="row"> 293 <div class="col-xs-24 col-sm-24 col-md-6"> 294 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.CompanyName", "Danespo A/S")</h4> 295 <ul class="list"> 296 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyAddress"]))) 297 { 298 <li class="list-item">@Pageview.Area.Item["CompanyAddress"]</li> 299 } 300 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyPhone"]))) 301 { 302 <li class="list-item">@Translate("Smartpage:Footer.CompanyInfo.Phone", "Telefon:") @Pageview.Area.Item["CompanyPhone"]</li> 303 } 304 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyEmail"]))) 305 { 306 <li class="list-item">@Translate("Smartpage:Footer.CompanyInfo.Email", "Email:") @Pageview.Area.Item["CompanyEmail"]</li> 307 } 308 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyNo"]))) 309 { 310 <li class="list-item">@Translate("Smartpage:Footer.CompanyInfo.CompanyNo", "CVR nr.") @Pageview.Area.Item["CompanyNo"]</li> 311 } 312 </ul> 313 </div> 314 <div class="col-xs-24 col-sm-24 col-md-6"> 315 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.Production", "Produktion")</h4> 316 @GetValue("DwNavigation(footerlist1)") 317 </div> 318 <div class="col-xs-24 col-sm-24 col-md-6"> 319 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.Profile", "Om os")</h4> 320 @GetValue("DwNavigation(footerlist2)") 321 </div> 322 <div class="col-xs-24 col-sm-24 col-md-6"> 323 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.Links", "Links")</h4> 324 <ul class="list inline"> 325 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["FacebookLink"]))) 326 { 327 <li class="list-item"> 328 <a href='@Pageview.Area.Item["FacebookLink"]' target="_blank" class="list-item-link facebook"></a> 329 </li> 330 } 331 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["SmileyLink"]))) 332 { 333 string smileyLink = Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["SmileyLink"]); 334 <li class="list-item"> 335 <a href="@smileyLink" target="_blank" class="list-item-link smiley"></a> 336 </li> 337 } 338 </ul> 339 </div> 340 </div> 341 </div> 342 </footer> 343 344 <script> 345 (function (d) { 346 var config = { 347 kitId: 'znw6ggx', 348 scriptTimeout: 3000, 349 async: true 350 }, 351 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) 352 })(document); 353 </script> 354 355 <script src='@designBaseUrl/Assets/Scripts/Main.min.js?v.1.6'></script> 356 @RenderSnippet("JavaScript") 357 <div id="fb-root"></div> 358 <script> 359 (function (d, s, id) { 360 var js, fjs = d.getElementsByTagName(s)[0]; 361 if (d.getElementById(id)) return; 362 js = d.createElement(s); js.id = id; 363 js.src = "//connect.facebook.net/da_DK/sdk.js#xfbml=1&version=v2.8"; 364 fjs.parentNode.insertBefore(js, fjs); 365 }(document, 'script', 'facebook-jssdk'));</script> 366 367 </body> 368 </html> 369