Error executing template "Designs/SeedsNZ/_parsed/SeedsNZ_Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_5774fc4f42344fb6af8c27496311cf9d.Execute() in D:\home\site\wwwroot\Application\Files\Templates\Designs\SeedsNZ\_parsed\SeedsNZ_Page.parsed.cshtml:line 161
   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.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits ViewModelTemplate<PageViewModel> 2 @using PgwSeeds.SeedsNZ 3 @using Dynamicweb.Frontend; 4 @using Dynamicweb.Rendering; 5 @using System.Configuration 6 @using System.Web; 7 @using System.Web.Optimization 8 @using System.Net 9 10 @{ 11 var tagManagerCode = Model.Area.Item.GetString("Google_TagManager_Code"); 12 var siteVerificationKey = Model.Area.Item.GetString("Google_Site_Verification_Key"); 13 } 14 15 16 <!DOCTYPE html> 17 <html> 18 <head> 19 @if (tagManagerCode != null) 20 { 21 <!-- Google Tag Manager --> 22 <script> 23 (function (w, d, s, l, i) { 24 w[l] = w[l] || []; w[l].push({ 25 'gtm.start': 26 new Date().getTime(), event: 'gtm.js' 27 }); var f = d.getElementsByTagName(s)[0], 28 j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = 29 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); 30 })(window, document, 'script', 'dataLayer', '@tagManagerCode'); 31 </script> 32 } 33 <script type="text/javascript"> 34 var sdkInstance = "appInsightsSDK"; window[sdkInstance] = "appInsights"; var aiName = window[sdkInstance], aisdk = window[aiName] || function (e) { function n(e) { t[e] = function () { var n = arguments; t.queue.push(function () { t[e].apply(t, n) }) } } var t = { config: e }; t.initialize = !0; var i = document, a = window; setTimeout(function () { var n = i.createElement("script"); n.src = e.url || "https://az416426.vo.msecnd.net/scripts/b/ai.2.min.js", i.getElementsByTagName("script")[0].parentNode.appendChild(n) }); try { t.cookie = i.cookie } catch (e) { } t.queue = [], t.version = 2; for (var r = ["Event", "PageView", "Exception", "Trace", "DependencyData", "Metric", "PageViewPerformance"]; r.length;)n("track" + r.pop()); n("startTrackPage"), n("stopTrackPage"); var s = "Track" + r[0]; if (n("start" + s), n("stop" + s), n("setAuthenticatedUserContext"), n("clearAuthenticatedUserContext"), n("flush"), !(!0 === e.disableExceptionTracking || e.extensionConfig && e.extensionConfig.ApplicationInsightsAnalytics && !0 === e.extensionConfig.ApplicationInsightsAnalytics.disableExceptionTracking)) { n("_" + (r = "onerror")); var o = a[r]; a[r] = function (e, n, i, a, s) { var c = o && o(e, n, i, a, s); return !0 !== c && t["_" + r]({ message: e, url: n, lineNumber: i, columnNumber: a, error: s }), c }, e.autoExceptionInstrumented = !0 } return t }( 35 { 36 instrumentationKey: '@ConfigurationManager.AppSettings["aiinstrumentationKey"]', 37 disableCorrelationHeaders: false 38 } 39 ); 40 window.appInsights = aisdk; 41 window.appInsights.queue.push(function () { 42 var serverId = "@HttpContext.Current.GetRequestTelemetry().Context.Operation.Id"; 43 appInsights.properties.context.telemetryTrace.traceID = serverId; 44 45 }); 46 aisdk.trackPageView(); 47 </script> 48 <meta charset="utf-8" /> 49 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 50 <meta name="google-site-verification" content="@siteVerificationKey" /> 51 @Model.MetaTags 52 <title>@Model.Title | PGG Wrightson Seeds</title> 53 54 <link rel="apple-touch-icon" sizes="57x57" href="/Files/Templates/Designs/SeedsNZ/assets/favicon/apple-touch-icon-57x57.png" /> 55 <link rel="apple-touch-icon" sizes="60x60" href="/Files/Templates/Designs/SeedsNZ/assets/favicon/apple-touch-icon-60x60.png" /> 56 <link rel="apple-touch-icon" sizes="72x72" href="/Files/Templates/Designs/SeedsNZ/assets/favicon/apple-touch-icon-72x72.png" /> 57 <link rel="apple-touch-icon" sizes="76x76" href="/Files/Templates/Designs/SeedsNZ/assets/favicon/apple-touch-icon-76x76.png" /> 58 <link rel="apple-touch-icon" sizes="114x114" href="/Files/Templates/Designs/SeedsNZ/assets/favicon/apple-touch-icon-114x114.png" /> 59 <link rel="apple-touch-icon" sizes="120x120" href="/Files/Templates/Designs/SeedsNZ/assets/favicon/apple-touch-icon-120x120.png" /> 60 <link rel="icon" type="image/png" sizes="32x32" href="/Files/Templates/Designs/SeedsNZ/assets/favicon/favicon-32x32.png" /> 61 <link rel="icon" type="image/png" sizes="96x96" href="/Files/Templates/Designs/SeedsNZ/assets/favicon/favicon-96x96.png" /> 62 <link rel="icon" type="image/png" sizes="16x16" href="/Files/Templates/Designs/SeedsNZ/assets/favicon/favicon-16x16.png" /> 63 <link rel="icon" href="/Files/Templates/Designs/SeedsNZ/assets/favicon/favicon.ico" /> 64 65 <!-- FontAwesome --> 66 <script src="https://use.fontawesome.com/6326434619.js"></script> 67 68 <!-- TypeKit --> 69 <script src="https://use.typekit.net/oel8lyn.js"></script> 70 <script>try { Typekit.load({ async: false }); } catch (e) { }</script> 71 72 @Styles.Render("~/Content/custom/seedsnz") 73 74 @RenderSnippet("StyleSheet") 75 @RenderSnippet("JavaScript") 76 </head> 77 <body> 78 79 @if (tagManagerCode != null) 80 { 81 <!-- Google Tag Manager (no script) --> 82 <noscript> 83 <iframe src="https://www.googletagmanager.com/ns.html?id=@tagManagerCode" 84 height="0" width="0" style="display:none;visibility:hidden"></iframe> 85 </noscript> 86 } 87 88 <div class="layout__main wrap"> 89 @{ 90 var searchPage = GetPageIdByNavigationTag("Search"); 91 } 92 93 94 <header class="container-fluid"> 95 <div class="max-width-wrap col-no-padding-desktop"> 96 <div> 97 <nav class="navbar" role="navigation"> 98 <div class="navbar-header"> 99 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> 100 <span class="icon-bar"></span> 101 <span class="icon-bar"></span> 102 <span class="icon-bar"></span> 103 </button> 104 <a href="Default.aspx?Id=@GetPageIdByNavigationTag(NavigationTags.Home)" id="logo" title="Back to homepage"> 105 <img class="img-responsive" src="/Files/Templates/Designs/SeedsNZ/assets/img/logo.png" alt="PGG Wrightson Seeds Logo"> 106 </a> 107 </div> 108 109 <div class="navbar-collapse collapse pull-right-md"> 110 <ul class="nav navbar-nav pull-right-md" id="navbar"> 111 @RenderNavigation(new 112 { 113 Id = "navbar", 114 Template = "navbar.xslt", 115 ExpandMode = "All", 116 EndLevel = 3 117 }) 118 </ul> 119 120 <div class="search-btn-wrap visible-xs visible-sm"> 121 <a data-target="#search-wrapper" 122 data-toggle="collapse" 123 aria-expanded="false" 124 aria-controls="search-wrapper" 125 role="button"> 126 <span class="fa fa-search hidden-xs hidden-sm"></span> 127 <span class="search-text hidden-md hidden-lg">Search</span> 128 </a> 129 </div> 130 </div> 131 </nav> 132 </div> 133 </div> 134 <div class="row collapse" id="search-wrapper"> 135 <div class="max-width-wrap"> 136 <div class="form-search-wrap"> 137 <form method="get" action="Default.aspx" name="" novalidate="novalidate"> 138 <input type="hidden" name="ID" value="@searchPage" /> 139 <input type="search" placeholder="Enter Keyword to Search" name="q"> 140 <submit class="animate-right" role="button"> 141 <span class="rounded-icon icon fa fa-angle-right"></span> 142 </submit> 143 </form> 144 </div> 145 </div> 146 </div> 147 </header> 148 149 @inherits Dynamicweb.Rendering.ViewModelTemplate<PageViewModel> 150 151 @using Dynamicweb.Frontend; 152 153 154 @using PgwSeeds.SeedsNZ 155 @Title("Default page template") 156 157 158 @inherits Dynamicweb.Rendering.ViewModelTemplate<PageViewModel> 159 @using Dynamicweb.Frontend 160 @{ 161 var desktopImage = Model.Item.GetFile("DesktopImage")?.Path; 162 var handsetImage = Model.Item.GetFile("HandsetImage")?.Path; 163 var strapLineTop = Model.Item.GetString("StraplineTop"); 164 var strapLineBottom = Model.Item.GetString("StraplineBottom"); 165 var straplineNotice = Model.Item.GetString("StraplineNotice"); 166 var bannerImageAltText = Model.Item.GetString("BannerImageAltText"); 167 var bannerSecondLineColour = string.Empty; 168 169 if (!string.IsNullOrEmpty(Model.Item.GetString("StraplineBottomColor"))) 170 { 171 172 bannerSecondLineColour = $"color: {Model.Item.GetList("StraplineBottomColor").SelectedValue}"; 173 174 } 175 176 } 177 178 @if (!string.IsNullOrWhiteSpace(desktopImage)) 179 { 180 <div class="container-fluid banner-wrap"> 181 <div class="banner overflow-img-wrap"> 182 <img src="/Files/Templates/Designs/SeedsNZ/assets/img/1x1.png" alt="@bannerImageAltText" data-image-desktop="@desktopImage" data-image-handset="@handsetImage" class="img-srcset"> 183 <div class="strapline-wrap"> 184 <div class="max-width-wrap"> 185 <div class="wrap-md-offset-1-leftright"> 186 @if (!string.IsNullOrWhiteSpace(strapLineTop)) 187 { 188 <div class="strapline-inner-wrap"> 189 <h1 class="first-line truncate-text" data-lines-xs="1" data-lines-sm="1" data-lines-md="1" data-lines-lg="1">@strapLineTop</h1> 190 <h2 class="second-line truncate-text" data-lines-xs="1" data-lines-sm="1" data-lines-md="1" data-lines-lg="1" style="@bannerSecondLineColour; overflow-wrap: break-word;">@strapLineBottom</h2> 191 @if (!string.IsNullOrWhiteSpace(straplineNotice)) 192 { 193 <h3 class="notice-line truncate-text" data-lines-xs="1" data-lines-sm="1" data-lines-md="1" data-lines-lg="1" style="overflow-wrap: break-word;">@straplineNotice</h3> 194 } 195 </div> 196 } 197 </div> 198 </div> 199 </div> 200 </div> 201 </div> 202 } 203 204 205 206 @{ 207 var titleIcon = Model.Item.GetFile("TitleIcon")?.Path.IconImage(); 208 } 209 210 <div class="container"> 211 @if (Model.Item.GetBoolean("DisplayBreadCrumb")) 212 { 213 @RenderNavigation(new 214 { 215 id = "breadcrumbs", 216 template = @".\breadcrumb.xslt", 217 expandmode = "Pathonly" 218 }) 219 } 220 @{ 221 var logoutClass = Model.CurrentUser.ID > 0 ? "logout-wrap" : string.Empty; 222 } 223 <div class="wrap-md-offset-1-leftright @logoutClass"> 224 <div class="row"> 225 <div class="col-xs-12 col-sm-9 col-md-9 title-component-wrap"> 226 <div class="va-middle"> 227 <h1 class="title">@Model.Item.GetValue("Title")</h1> 228 @if (!string.IsNullOrWhiteSpace(Model.Item.GetString("Subtitle"))) 229 { 230 <h2 class="subtitle">@Model.Item.GetString("Subtitle")</h2> 231 } 232 </div> 233 </div> 234 <div class="col-xs-12 col-sm-3 col-md-3"> 235 @if (Model.Item.GetBoolean("Display_Logout") && Model.CurrentUser.ID > 0) 236 { 237 <a href="/Admin/Public/ExtranetLogoff.aspx?redirect=@System.Web.HttpUtility.UrlEncode("/Default.aspx?Id=245")" class="border-link danger pull-right">LOGOUT</a> 238 } 239 <div class="product-logo-wrapper text-right-sm"> 240 @if (!string.IsNullOrWhiteSpace(titleIcon)) 241 { 242 <img src="@titleIcon" alt="@Model.Item.GetString("TitleIconAltText")"> 243 } 244 </div> 245 </div> 246 </div> 247 </div> 248 @Model.Placeholder("main") 249 </div> 250 251 252 <!-- SOCIAL SHARING --> 253 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 254 @using System.Web 255 <div class="share-wrap text-center"> 256 <h4>Share this page</h4> 257 @{ 258 var request = HttpContext.Current.Request; 259 var subPath = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(request.Url.PathAndQuery.TrimStart('/')); 260 var friendlyUrl = $"{request.Url.Scheme}://{request.Url.Authority}{subPath}"; 261 var url = WebUtility.UrlEncode(friendlyUrl); 262 } 263 <ul class="list-inline"> 264 <li> 265 <a class="fa fa-facebook text-center" href="https://www.facebook.com/sharer/sharer.php?u=@url" title="Share page via Facebook" target="_blank"></a> 266 </li> 267 <li> 268 <a class="fa fa-twitter text-center" href="https://twitter.com/home?status=@url" title="Share page via Twitter" target="_blank"></a> 269 </li> 270 <li> 271 <a class="fa fa-linkedin text-center" href="https://www.linkedin.com/shareArticle?mini=true&amp;url=@url" title="Share page via Linkedin" target="_blank"></a> 272 </li> 273 </ul> 274 </div> 275 276 <!-- Footer --> 277 <footer class="container-fluid contact-sticky-tile"> 278 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 279 @using Dynamicweb.Frontend 280 @using PgwSeeds.SeedsNZ 281 282 @{ 283 var footerColumns = Model.Area.Item.GetItems("Columns") != null ? Model.Area.Item.GetItems("Columns").Take(4) : new List<ItemViewModel>(); 284 } 285 286 <div class="max-width-wrap"> 287 <!-- duplication for mobile --> 288 <div class="clearfix"> 289 <div class="clearfix"> 290 <div class="mobile-compact-contact-wrap hidden-md hidden-lg col-xs-12 col-sm-6"> 291 <a class="collapsed" data-target="#contact-footer-tile" role="button" data-toggle="collapse" aria-expanded="false" aria-controls="contact-footer-tile"> 292 <h4> 293 <span class="greeting">HI!</span> NEED TO GET IN TOUCH? 294 </h4> 295 <img src="/Files/Templates/Designs/SeedsNZ/assets/img/Phone.jpg" maxheight="120" 296 class="img-responsive img-circle" alt="General Contact" maxwidth="120"> 297 </a> 298 </div> 299 </div> 300 301 <div class="clearfix"> 302 <div class="col-sm-5 pull-right hidden-sm hidden-xs contact-footer-desktop"> 303 <div class="contact-tile-outer-wrap"> 304 <div class="contact-us-greeting"> 305 <div class="contact-us-greeting-inner"> 306 <a class="collapsed" data-target="#contact-footer-tile" role="button" data-toggle="collapse" aria-expanded="false" aria-controls="contact-footer-tile"> 307 <h4> 308 <span class="greeting">HI!</span> NEED TO GET IN TOUCH? 309 </h4> 310 </a> 311 </div> 312 </div> 313 </div> 314 </div> 315 </div> 316 317 318 <div class="hidden-lg hidden-md collapseable collapse" id="contact-footer-tile"> 319 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 320 @using PgwSeeds.SeedsNZ 321 <div class="contact-tile-outer-wrap"> 322 <div class="contact-tile-wrap"> 323 <div class="row"> 324 <div class="col-xs-4 col-no-right-padding"> 325 <img src="/Files/Templates/Designs/SeedsNZ/assets/img/Phone.jpg" maxheight="120" class="img-responsive img-circle" alt="General Contact" maxwidth="120"> 326 </div> 327 <div class="col-xs-8"> 328 <h4>Contact Us</h4> 329 <p> 330 Sales &amp; General Enquiries<br> Nationwide 331 </p> 332 </div> 333 </div> 334 <ul class="list-inline text-uppercase"> 335 <li> 336 <span class="glyphicon glyphicon-earphone"></span> 337 <a href="tel:@Pageview.Area.Item["NZPhoneNumber"]"> 338 @Pageview.Area.Item["NZPhoneNumber"] 339 </a> 340 </li> 341 <li> 342 <span class="glyphicon glyphicon-envelope"></span> 343 <a href="mailto:@Pageview.Area.Item["Email"];"> 344 Email Me 345 </a> 346 </li> 347 348 </ul> 349 </div> 350 <a class="animate-right" href="Default.aspx?ID=@GetPageIdByNavigationTag(NavigationTags.ContactUs)"> 351 <span>Contact your local rep</span> 352 <span class="rounded-icon icon fa fa-angle-right"></span> 353 </a> 354 </div> 355 356 357 </div> 358 </div> 359 <!-- duplication for mobile --> 360 <div class="row"> 361 <div class="col-md-6 col-sm-12 link-tiles-wrap"> 362 <div class="row"> 363 @foreach (var aColumn in footerColumns) 364 { 365 var subLinks = aColumn.GetItems("Sub_Links"); 366 <div class="col-md-3 col-sm-3 col-xs-6"> 367 <strong>@aColumn.GetString("Title")</strong> 368 @if (subLinks.Any()) 369 { 370 <ul class="list-unstyled"> 371 @foreach (var link in subLinks) 372 { 373 var hrefValue = link.GetBoolean("Is_Download_Link") ? link.GetString("Link").GetDownloadPath() : link.GetString("Link"); 374 <li> 375 <a href="@hrefValue">@link.GetString("Name")</a> 376 </li> 377 } 378 </ul> 379 } 380 </div> 381 } 382 </div> 383 <div class="row"> 384 <div class="col-xs-6 col-md-12"> 385 <div class="member-login va-middle hidden-sm hidden-xs"> 386 387 @if (Model.CurrentUser.ID == 0) 388 { 389 <a href="Default.aspx?ID=@GetPageIdByNavigationTag(NavigationTags.LoginPage)" class="member-login btn btn-default">Retail Login</a> 390 } 391 else 392 { 393 <a href="Default.aspx?ID=@GetPageIdByNavigationTag(NavigationTags.MemberHome)" class="member-login btn btn-default">Retail Home</a> 394 } 395 </div> 396 <div class="footer-social-bar va-middle"> 397 <a href="https://www.facebook.com/@Pageview.Area.Item["Facebook_Page"]/" class="fa fa-facebook" target="_blank" title="PGW Seeds Facebook"></a> 398 <a href="https://twitter.com/@Pageview.Area.Item["TwitterHandle"]" class="fa fa-twitter" target="_blank" title="PGW Seeds Twiiter"></a> 399 </div> 400 </div> 401 402 <div class="member-login va-middle hidden-md hidden-lg col-xs-6"> 403 404 @if (Model.CurrentUser.ID == 0) 405 { 406 <a href="Default.aspx?ID=@GetPageIdByNavigationTag(NavigationTags.LoginPage)" class="member-login btn btn-default">Retail Login</a> 407 } 408 else 409 { 410 <a href="Default.aspx?ID=@GetPageIdByNavigationTag(NavigationTags.MemberHome)" class="member-login btn btn-default">Retail Home</a> 411 } 412 </div> 413 </div> 414 </div> 415 <div class="col-sm-5 pull-right hidden-sm hidden-xs"> 416 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 417 @using PgwSeeds.SeedsNZ 418 <div class="contact-tile-outer-wrap"> 419 <div class="contact-tile-wrap"> 420 <div class="row"> 421 <div class="col-xs-4 col-no-right-padding"> 422 <img src="/Files/Templates/Designs/SeedsNZ/assets/img/Phone.jpg" maxheight="120" class="img-responsive img-circle" alt="General Contact" maxwidth="120"> 423 </div> 424 <div class="col-xs-8"> 425 <h4>Contact Us</h4> 426 <p> 427 Sales &amp; General Enquiries<br> Nationwide 428 </p> 429 </div> 430 </div> 431 <ul class="list-inline text-uppercase"> 432 <li> 433 <span class="glyphicon glyphicon-earphone"></span> 434 <a href="tel:@Pageview.Area.Item["NZPhoneNumber"]"> 435 @Pageview.Area.Item["NZPhoneNumber"] 436 </a> 437 </li> 438 <li> 439 <span class="glyphicon glyphicon-envelope"></span> 440 <a href="mailto:@Pageview.Area.Item["Email"];"> 441 Email Me 442 </a> 443 </li> 444 445 </ul> 446 </div> 447 <a class="animate-right" href="Default.aspx?ID=@GetPageIdByNavigationTag(NavigationTags.ContactUs)"> 448 <span>Contact your local rep</span> 449 <span class="rounded-icon icon fa fa-angle-right"></span> 450 </a> 451 </div> 452 453 454 </div> 455 </div> 456 </div> 457 </footer> 458 <div class="visible-lg-block visible-md-block visible-sm-block visible-xs-block go-to-top hidden"> 459 <div class="triangle"></div> 460 TOP 461 </div> 462 </div> 463 464 <script src="https://code.jquery.com/jquery.min.js"></script> 465 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.1/jquery.validate.min.js"></script> 466 <!-- Custom handling of unobtrusive validation css classes --> 467 <script src="Files/Templates/Designs/Common/assets/js/validation.custom.js"></script> 468 469 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validation-unobtrusive/3.2.11/jquery.validate.unobtrusive.min.js"></script> 470 471 @Scripts.Render("~/bundles/custom/seedsnz") 472 @RenderSnippet("JavaScriptBottom") 473 <!--[if lt IE 9]> 474 <script src="/Assets/Core/js/dist/ie/html5shiv.min.js"></script> 475 <script src="/Assets/Core/js/dist/ie/respond.min.js"></script> 476 <![endif]--> 477 <!--[if lt IE 10]> 478 <script src="/Assets/Core/js/dist/ie/jquery.placeholder.min.js"></script> 479 window.onload = function() { 480 $('input, textarea').placeholder(); 481 }; 482 <![endif]--> 483 </body> 484 </html>