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_48e8558b8d1e47f0b955dd95bea72a26.Execute() in D:\Sites\danespoDW\Application_9.7.4\Files\Templates\Designs\Danespo\_parsed\Page.parsed.cshtml:line 271
   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 @RenderSnippet("Styling") 70 71 @{ 72 string alternativeColor = Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["AlternativeColor"]); 73 74 if (!string.IsNullOrEmpty(alternativeColor)) 75 { 76 <style type="text/css"> 77 .content-row-wrapper .content-row-content-wrapper .content-row-content.style2 .content-row-link-alternative { 78 background-color: @alternativeColor; 79 } 80 </style> 81 } 82 } 83 84 <!-- Google Tag Manager --> 85 <script> 86 (function (w, d, s, l, i) { 87 w[l] = w[l] || []; w[l].push( 88 { 'gtm.start': new Date().getTime(), event: 'gtm.js' } 89 ); var f = d.getElementsByTagName(s)[0], 90 j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = 91 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); 92 })(window, document, 'script', 'dataLayer', 'GTM-NWHDKFK'); 93 </script> 94 <!-- End Google Tag Manager --> 95 @GetValue("Stylesheets") 96 @GetValue("Javascripts") 97 </head> 98 <body> 99 <!-- Google Tag Manager (noscript) --> 100 <noscript> 101 <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NWHDKFK" height="0" width="0" style="display:none;visibility:hidden"></iframe> 102 </noscript> 103 <!-- End Google Tag Manager (noscript) --> 104 <div class="wrapper"> 105 <div class="page"> 106 107 <header class="header"> 108 <div class="header-topline hidden-sm-down"> 109 <div class="container"> 110 <div class="row"> 111 <div class="col-md-12 header-tabs"> 112 @if (languageTag == "da") 113 { 114 if (isAlternativeSite) 115 { 116 <span class="tab active-tab">@Translate("Smartpage:Header.Sites.Site1", "Forbruger")</span> 117 <a href='@GetValue("Item.Area.AlternativeSite")' class="tab ">@Translate("Smartpage:Header.Sites.Site2", "Erhverv")</a> 118 } 119 else 120 { 121 <a href='@GetValue("Item.Area.AlternativeSite")' class="tab">@Translate("Smartpage:Header.Sites.Site1", "Forbruger")</a> 122 <span class="tab active-tab">@Translate("Smartpage:Header.Sites.Site2", "Erhverv")</span> 123 } 124 } 125 126 127 </div> 128 <div class="col-md-12 header-lang-select"> 129 @if (languages.Any() && Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["LanguageActive"]) == "True") 130 { 131 <div class="dropdown"> 132 <button class="dropdown-button" type="button" id="desktopLangSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 133 @languages.FirstOrDefault(l => l.GetBoolean("IsCurrent")).GetString("Name") 134 </button> 135 <div class="dropdown-menu" aria-labelledby="desktopLangSelect"> 136 @foreach (var language in languages) 137 { 138 string url = "/Default.aspx?id=" + language.GetValue("FirstPageID"); //for pretty urls 139 string isMaster = language.GetBoolean("IsMaster") ? "js-langmaster" : ""; 140 141 <a href="@url" class="dropdown-item @isMaster"> 142 @language.GetValue("Name") 143 </a> 144 } 145 </div> 146 </div> 147 } 148 </div> 149 </div> 150 </div> 151 </div> 152 153 <div class="header-topbar"> 154 <div class="container"> 155 <div class="row"> 156 <div class="col-xs-18 col-sm-8 col-md-4 col-lg-4 header-logo"> 157 <a href='@GetValue("Item.Area.SiteFrontpage")' class="header-logo-link"> 158 <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"])'> 159 <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"])'> 160 </a> 161 </div> 162 163 <div class="col-xs-6 col-sm-16 hidden-md-up header-hamburger"> 164 <button class="hamburger hamburger--slider js-navigation-toggle" type="button"> 165 <span class="hamburger-box"> 166 <span class="hamburger-inner"></span> 167 </span> 168 </button> 169 </div> 170 171 <div class="col-xs-24 col-sm-24 col-md-20 col-lg-20 header-navigation"> 172 <div class="navigation js-navigation"> 173 174 <div class="header-topline hidden-md-up"> 175 <div class="container"> 176 <div class="row"> 177 <div class="col-xs-14 header-tabs"> 178 @if (isAlternativeSite) 179 { 180 <span class="tab active-tab">@Translate("Smartpage:Header.Sites.Site1", "Forbruger")</span> 181 <a href='@GetValue("Item.Area.AlternativeSite")' class="tab ">@Translate("Smartpage:Header.Sites.Site2", "Erhverv")</a> 182 } 183 else 184 { 185 <a href='@GetValue("Item.Area.AlternativeSite")' class="tab">@Translate("Smartpage:Header.Sites.Site1", "Forbruger")</a> 186 <span class="tab active-tab">@Translate("Smartpage:Header.Sites.Site2", "Erhverv")</span> 187 } 188 </div> 189 <div class="col-xs-10 header-lang-select"> 190 @if (languages.Any() && !isAlternativeSite) 191 { 192 <div class="dropdown"> 193 <button class="dropdown-button" type="button" id="mobileLangSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 194 @languages.FirstOrDefault(l => l.GetBoolean("IsCurrent")).GetString("Name") 195 </button> 196 <div class="dropdown-menu" aria-labelledby="mobileLangSelect"> 197 @foreach (var language in languages) 198 { 199 <a href='/Default.aspx?id=@language.GetValue("FirstPageID")' class="dropdown-item"> 200 @language.GetValue("Name") 201 </a> 202 } 203 </div> 204 </div> 205 } 206 </div> 207 </div> 208 </div> 209 </div> 210 211 <div class="navigation-wrap"> 212 @GetValue("DwNavigation(mainnavigation)") 213 </div> 214 215 </div> 216 </div> 217 218 </div> 219 </div> 220 221 </div> 222 </header> 223 224 <div class="content-wrapper"> 225 @using System; 226 @using System.Web; 227 @using System.Linq; 228 @using Dynamicweb; 229 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 230 231 232 233 @using System; 234 @using System.Web; 235 @using Dynamicweb; 236 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 237 238 @helper RenderBreadcrumbs() 239 { 240 241 if ((Pageview.Page.PropertyItem != null && Dynamicweb.Core.Converter.ToBoolean(Pageview.Page.PropertyItem["ShowBreadcrumbsOnPage"])) && Dynamicweb.Core.Converter.ToBoolean(Pageview.Area.Item["ShowBreadcrumbsOnWebsite"])) 242 { 243 @GetValue("DwNavigation(mainbreadcrumbs)") 244 } 245 } 246 247 <div class="container"> 248 @RenderFacebookShare() 249 250 <div class="row page-row"> 251 <div class="col-xs-24 col-sm-24 col-md-16 col-lg-18"> 252 253 <div class="page-content"> 254 <ul class="breadcrumbs" itemscope="" itemtype="http://schema.org/ListItem"> 255 @RenderBreadcrumbs() 256 257 </ul> 258 <div id="content">@GetValue("DwContent(content)")</div> 259 260 </div> 261 </div> 262 <div class="col-xs-24 col-sm-24 col-md-8 col-lg-6"> 263 <div class="page-side" id="side">@GetValue("DwContent(side)")</div> 264 </div> 265 </div> 266 </div> 267 268 269 @SnippetStart("Styling") 270 @{ 271 string backgroundImagePath = Dynamicweb.Core.Converter.ToString(Pageview.Page.PropertyItem["BackgroundImage"]); 272 string backgroundImage = "url('" + backgroundImagePath + "')"; 273 } 274 @if (!string.IsNullOrEmpty(backgroundImagePath)) 275 { 276 <style type="text/css"> 277 body { 278 background-image: @backgroundImage; 279 } 280 </style> 281 } 282 @SnippetEnd("Styling") 283 </div> 284 285 </div> 286 287 </div> 288 289 <footer class="footer"> 290 <div class="container"> 291 <div class="row"> 292 <div class="col-xs-24 col-sm-24 col-md-6"> 293 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.CompanyName", "Danespo A/S")</h4> 294 <ul class="list"> 295 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyAddress"]))) 296 { 297 <li class="list-item">@Pageview.Area.Item["CompanyAddress"]</li> 298 } 299 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyPhone"]))) 300 { 301 <li class="list-item">@Translate("Smartpage:Footer.CompanyInfo.Phone", "Telefon:") @Pageview.Area.Item["CompanyPhone"]</li> 302 } 303 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyEmail"]))) 304 { 305 <li class="list-item">@Translate("Smartpage:Footer.CompanyInfo.Email", "Email:") @Pageview.Area.Item["CompanyEmail"]</li> 306 } 307 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CompanyNo"]))) 308 { 309 <li class="list-item">@Translate("Smartpage:Footer.CompanyInfo.CompanyNo", "CVR nr.") @Pageview.Area.Item["CompanyNo"]</li> 310 } 311 </ul> 312 </div> 313 <div class="col-xs-24 col-sm-24 col-md-6"> 314 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.Production", "Produktion")</h4> 315 @GetValue("DwNavigation(footerlist1)") 316 </div> 317 <div class="col-xs-24 col-sm-24 col-md-6"> 318 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.Profile", "Om os")</h4> 319 @GetValue("DwNavigation(footerlist2)") 320 </div> 321 <div class="col-xs-24 col-sm-24 col-md-6"> 322 <h4 class="h4">@Translate("Smartpage:Footer.List.Header.Links", "Links")</h4> 323 <ul class="list inline"> 324 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["FacebookLink"]))) 325 { 326 <li class="list-item"> 327 <a href='@Pageview.Area.Item["FacebookLink"]' target="_blank" class="list-item-link facebook"></a> 328 </li> 329 } 330 @if (!string.IsNullOrEmpty(Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["SmileyLink"]))) 331 { 332 string smileyLink = Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["SmileyLink"]); 333 <li class="list-item"> 334 <a href="@smileyLink" target="_blank" class="list-item-link smiley"></a> 335 </li> 336 } 337 </ul> 338 </div> 339 </div> 340 </div> 341 </footer> 342 343 <script> 344 (function (d) { 345 var config = { 346 kitId: 'znw6ggx', 347 scriptTimeout: 3000, 348 async: true 349 }, 350 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) 351 })(document); 352 </script> 353 354 <script src='@designBaseUrl/Assets/Scripts/Main.min.js?v.1.6'></script> 355 @RenderSnippet("JavaScript") 356 <div id="fb-root"></div> 357 <script> 358 (function (d, s, id) { 359 var js, fjs = d.getElementsByTagName(s)[0]; 360 if (d.getElementById(id)) return; 361 js = d.createElement(s); js.id = id; 362 js.src = "//connect.facebook.net/da_DK/sdk.js#xfbml=1&version=v2.8"; 363 fjs.parentNode.insertBefore(js, fjs); 364 }(document, 'script', 'facebook-jssdk'));</script> 365 366 </body> 367 </html> 368