Exception in template (Designs/Alkmaar Marketing/_parsed/Event.parsed.cshtml): System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.bdaebabcfafa.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
   at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.Output()
@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb; <!DOCTYPE html> @{ var httpdomain = Base.GetHttpDomain(); var ogurl = string.Format("{0}{1}", httpdomain, GetGlobalValue("Global:Pageview.Url")); var cultShort = GetString("Lang"); } <html lang="@cultShort"> <head prefix="og: http://ogp.me/ns#"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> @*<meta name="viewport" content="width=device-width, initial-scale=1">*@ <meta name="viewport" content="width=device-width, initial-scale=1.0001, minimum-scale=1.0001, maximum-scale=1.0001"> <meta name="theme-color" content="#fff"> <meta property="og:site_name" content="Alkmaar Marketing"> <meta property="og:url" content="@ogurl"> @RenderSnippet("ogTags") <title>@GetValue("Title")</title> @GetValue("MetaTags") @GetValue("CopyRightNotice") <link href="//fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"> <link href="/Files/Templates/Designs/Alkmaar%20Marketing/dist/css/style.min.css" rel="stylesheet"> <link rel="icon" href="/Files/Templates/Designs/Alkmaar%20Marketing/img/favicon.png" type="image/x-icon"> @* <link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css"> *@ @GetString("Item.Area.Custom_Html_Head") @GetValue("Stylesheets") @GetValue("Javascripts") </head> <body> @GetString("Item.Area.Google_Tag_Manager") @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb; @using Dynamicweb.Content; @using System.Globalization; <!-- Begin header --> @{ var introheader = GetString("Item.Page.Intro_Title"); var introcontent = GetString("Item.Page.Intro_Content"); var introbuttontext = GetString("Item.Page.Intro_Button_Text"); var introbuttonlink = GetString("Item.Page.Intro_Button_Url"); var introimg = GetString("Item.Page.Intro_Image"); var introimgMobile = GetString("Item.Page.Image_Mobile"); var imgtag = !string.IsNullOrWhiteSpace(introimg) ? string.Format("background-image: url('{0}');", introimg) : ""; var ishome = GetInteger("DwAreaFirstPageID") == GetInteger("Global.PageId"); var homeheader = ishome ? "header--homepage" : ""; var obj_pageViewCurrent = Dynamicweb.Frontend.PageView.Current(); string areaID = obj_pageViewCurrent.AreaID.ToString(); string countryCode = GetGlobalValue("Global:Area.Culture.CountryCode"); Dynamicweb.Content.Area areaCurrent = Dynamicweb.Content.Area.GetAreaById(Convert.ToInt32(areaID)); CultureInfo cultureCurrent = CultureInfo.GetCultureInfo(areaCurrent.Culture); string currentCultureFlag = string.Format("/Admin/Images/Flags/flag_{0}.png", areaCurrent.Culture.Substring(3, 2).ToLower()); var staticLinks = GetLoop("Item.Area.StaticLinks"); var languages = GetLoop("Languages").Where(x => !x.GetBoolean("IsCurrent")); var listType = GetString("Item.Area.ListType"); string defaultLogo = "/Files/Templates/Designs/Alkmaar Marketing/img/header__logo.png"; string websiteLogo = !string.IsNullOrEmpty(GetString("Item.Area.Logo")) ? GetString("Item.Area.Logo") : defaultLogo; } <header class="header @homeheader" style="@imgtag" data-mobileimg="@introimgMobile" data-introimg="@introimg"> <section class="intro"> <div class="intro__content"> @if (!string.IsNullOrWhiteSpace(introheader)) { <h1 class="intro__header">@introheader</h1>} @if (!string.IsNullOrWhiteSpace(introcontent)) { <p>@introcontent</p>} @if (!string.IsNullOrWhiteSpace(introbuttontext) && !string.IsNullOrWhiteSpace(introbuttonlink)) { <a href="@introbuttonlink" class="intro__cta">@introbuttontext</a>} </div> </section> <section class="header__container container-fluid header__container--sticky"> <a href="/" class="header__logo"> <figure class="header__logo-img"></figure> </a> @{ var searchpage = GetString("Item.Area.SearchPageID"); var searchplaceholder = Translate("Search.PlaceholderText", "Waar bent u naar op zoek?"); <section class="searchbox"> <form class="searchbox__form" method="get" action="/Default.aspx"> <input type="hidden" name="ID" value="@searchpage"> <input type="text" name="q" value="" placeholder="@searchplaceholder" class="searchbox__input"> <i class="searchbox__close hidden-md-up"></i> </form> <a href="#" class="mainmenu__searchtoggle"></a> </section> } <nav class="mainmenu"> <div> <ul class="mainmenu__buttons"> <!-- <li class="mainmenu__buttons-button"><a href="#" class="mainmenu__searchtoggle"></a></li> --> <li class="mainmenu__buttons-button"> <a href="#" id="language" class="mainmenu__languageswitch" style="background-image: url('@currentCultureFlag');"></a> <ul id="languageDropdown" class="mainmenu__languageswitch--dropdown" role="menu" aria-labelledby="languageselect"> @if ((listType == "all" || listType == "language") && languages.Any()) { foreach (var language in languages) { var homepage = language.GetInteger("FirstActivePageID"); var name = language.GetString("Name"); string languageCode = language.GetString("Culture").Substring(3, 2).ToLower(); int pageId = language.GetInteger("PageID"); int areaId = language.GetInteger("ID"); string isCurrent = language.GetBoolean("IsCurrent") ? " selected " : ""; bool isMaster = language.GetBoolean("IsMaster"); Page linkPage = Page.GetPageBySql("Select * from Page where PageAreaID = '" + areaID + "' and PageMasterPageID = '" + pageId + "'"); string pageVersionID = linkPage != null ? linkPage.ID.ToString() : pageId.ToString(); string pageUrl = "/Default.aspx?ID=" + pageVersionID; var cultureFlag = string.Format("/Admin/Images/Flags/flag_{0}.png", languageCode); //int localizedPageID = "1"; //pageId > 0 ? pageService.GetPageIDByMasterID(pageId, areaId) : homepage; //pageId = localizedPageID == 0 ? pageId : localizedPageID; //string pageUrl = "";// Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(pageId); <li role="presentation" data-current="@isCurrent"> <a role="menuitem" tabindex="-1" href='@pageUrl' title="@name" style="background-image: url(@cultureFlag);" class="mainmenu__languageswitch"></a> </li> } } @if ((listType == "all" || listType == "static") && staticLinks.Any()) { foreach (var staticLink in staticLinks) { var txt = staticLink.GetString("Item.Area.StaticLinks.Title"); var link = staticLink.GetString("Item.Area.StaticLinks.Link"); var icon = staticLink.GetString("Item.Area.StaticLinks.Icon"); var flag = string.Format("/Admin/Images/Flags/flag_{0}.png", icon); if (!string.IsNullOrWhiteSpace(txt) && !string.IsNullOrWhiteSpace(link)) { <li role="presentation"> <a role="menuitem" tabindex="-1" href="@link" title="@txt" style="background-image: url(@flag);" target="_blank" class="mainmenu__languageswitch"></a> </li> } } } </ul> </li> <li class="mainmenu__buttons-button"><a href="#" class="mainmenu__toggle"></a></li> </ul> </div> <div class="mainmenu__items"> @if (ishome) { <ul class="mainmenu__list mainmenu__list--homemenu hidden-md-up"> @GetValue("DwNavigation(homemenu)") </ul> } <ul class="mainmenu__list"> @GetValue("DwNavigation(mainmenu)") </ul> </div> <div class="mainmenu__social"> @{ var fbLink = GetString("Item.Area.Facebook"); var twitterLink = GetString("Item.Area.Twitter"); var instagramLink = GetString("Item.Area.Instagram"); if (!string.IsNullOrWhiteSpace(fbLink)) { <a href="@fbLink" target="_blank" title="Facebook" class="mainmenu__sociallink mainmenu__sociallink--fb"> <img src="/Files/Templates/Designs/Alkmaar%20Marketing/img/socialmedia__icon--facebook.png"> </a> } if (!string.IsNullOrWhiteSpace(twitterLink)) { <a href="@twitterLink" target="_blank" title="Twitter" class="mainmenu__sociallink mainmenu__sociallink--twitter"> <img src="/Files/Templates/Designs/Alkmaar%20Marketing/img/socialmedia__icon--twitter.png"> </a> } if (!string.IsNullOrWhiteSpace(instagramLink)) { <a href="@instagramLink" target="_blank" title="Instagram" class="mainmenu__sociallink mainmenu__sociallink--ig"> <img src="/Files/Templates/Designs/Alkmaar%20Marketing/img/socialmedia__icon--instagram.png"> </a> } } </div> </nav> </section> </header> <!-- End header --> @if (GetInteger("DwAreaFirstPageID") == GetInteger("Global.PageId") && !(string.IsNullOrWhiteSpace(GetString("Item.Area.ShoutboxSubtitle.Value")) && string.IsNullOrWhiteSpace(GetString("Item.Area.ShoutboxTitle.Value")))) { var link = GetString("Item.Area.ShoutLink.Value"); <div class="shoutbox"> <a href="@link" class="shoutbox__link"> <span class="shoutbox__date">@GetString("Item.Area.ShoutboxSubtitle.Value")</span> <span class="shoutbox__title">@GetString("Item.Area.ShoutboxTitle.Value")</span> </a> </div> } @if (GetBoolean("Item.Page.ShowShoutbox")) { var link = GetString("Item.Page.ShoutboxLink"); var text = GetString("Item.Page.ShoutboxText"); <div class="shoutbox shoutbox--custom"> <a href="/Default.aspx?Id=@link" class="shoutbox__link"> <span class="shoutbox__title">@text</span> </a> </div> @SnippetStart("ShoutboxButton") <div> <a href="/Default.aspx?Id=@link" class="filters__input filters__input--diap">@text</a> </div> @SnippetEnd("ShoutboxButton") } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb; @using System.Linq; @using Bluedesk.DynamicWeb.ExtensionMethods; @using Bluedesk.DynamicWeb.ItemTypes.Events; @SnippetStart("AddThis") <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-58b57d1ac939fad1"></script> @SnippetEnd("AddThis") @{ // What are we showing ? var currentItemType = Pageview.Item.SystemName; // check if we are showing the main event var isMainEvent = !Pageview.Page.Parent.Item.SystemName.Equals(currentItemType); var _data = Event.CreateFrom(Pageview.Item.SerializeTo()); var variant_data = new Event(); if (!isMainEvent) { // Event variant is displayed, we should start with loading the parent item for the default values. SerializeTo() with no parameters is an extension from the Bluedesk.DynamicWeb library _data.DeserializeFrom(Pageview.Page.Parent.Item.SerializeTo()); variant_data.DeserializeFrom(Pageview.Item.SerializeTo()); // merge related event data into the main event data. All available data from the related office will override de data of the main office. // Take special care of the Name fields, they should both be filled. Title for the url and OfficeName for the header. _data.Merge(variant_data); } } @{ bool multipleDays = (_data.End.DayOfYear > _data.Start.DayOfYear) || (_data.End.Year > _data.Start.Year) || (_data.Start != null && _data.End == null); var category = new Dynamicweb.Frontend.Page(); if (isMainEvent) { category = Pageview.Page.Parent.Item.SystemName.Equals("EventCategory") ? Pageview.Page.Parent : null; } else { category = Pageview.Page.Parent.Parent.Item.SystemName.Equals("EventCategory") ? Pageview.Page.Parent.Parent : null; } } <section class="container-fluid"> <div class="row no-gutter detailpage"> <section class="col-xs-12 col-md-6 col-lg-5 col-lg-offset-1"> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb; @{ var title = _data.Header; //GetString("Item.Header"); var date = GetDate("Item.PublishDate").ToString("dd-MM-yyyy"); ; //GetString("Item.PublishDate"); var subtitle = _data.Subheader; // GetString("Item.Subheader"); var content = _data.Content; //GetString("Item.Content"); var btntext = _data.ButtonText;// GetString("Item.ButtonText"); var btnurl = _data.ButtonLink;// GetString("Item.ButtonLink"); var sale = GetString("Item.Actie"); } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb; @if (!GetBoolean("Item.Page.HideBreadcrumbs")) { <nav class="breadcrumbnav"> @GetValue("DwNavigation(breadcrumblist)") </nav> } <section class="detail"> @{ if (!string.IsNullOrWhiteSpace(title)) { <h1 class="detail__header">@title</h1> } if (!string.IsNullOrWhiteSpace(subtitle)) { <h2 class="detail__subheader">@subtitle</h2> } if (!string.IsNullOrWhiteSpace(date) && date != "01-01-0001") { <p class="detail__publish-date">@Translate("PublishedOn.News.Date", "Gepubliceerd op"): @date</p> } if (!string.IsNullOrWhiteSpace(content)) { <article class="detail__content"> @content </article> } if (!string.IsNullOrWhiteSpace(sale)) { <strong class="detail__sale">@sale</strong> } if (!string.IsNullOrWhiteSpace(btntext) && !string.IsNullOrWhiteSpace(btnurl)) { <footer class="detail__footer"> <a href="@btnurl" class="detail__cta">@btntext</a> </footer> } } </section> </section> <aside class="meta col-xs-12 col-md-5 col-md-offset-1"> <div class="row meta__content"> <strong class="meta__header">Evenement Informatie:</strong> <table> @if (multipleDays) { <tr> <td> Van: </td> <td> @_data.Start.ToString("dd MMM yyyy") </td> </tr> <tr> <td> Tot: </td> <td> @_data.End.ToString("dd MMM yyyy") </td> </tr> } else { <tr> <td> <i class="far fa-calendar"></i>Datum: </td> <td> @_data.Start.ToString("dd MMM yyyy") </td> </tr> } @if (!multipleDays) { <tr> <td> <i class="far fa-clock"></i>Tijd: </td> <td>@_data.Start.ToString("HH:mm") - @_data.End.ToString("HH:mm")</td> </tr> } @if (!string.IsNullOrWhiteSpace(_data.Location)) { <tr> <td> <i class="far fa-map-marker"></i>Locatie: </td> <td>@_data.Location</td> </tr> } @if (category != null && !string.IsNullOrWhiteSpace(category.Item["Name"].ToString())) { <tr> <td> <i class="far fa-list-alt"></i>Categorie: </td> <td> <a href="/Default.aspx?ID=@category.ID"> @category.Item["Name"].ToString() </a> </td> </tr> } @if (!string.IsNullOrWhiteSpace(_data.ContactUrl)) { var clearurl = _data.ContactUrl.Contains("http") ? _data.ContactUrl : "http://" + _data.ContactUrl; <tr> <td> <i class="far fa-globe"></i>Website: </td> <td><a href="@clearurl" target="_blank">@_data.ContactUrl.Replace("http://", "").Replace("https://", "")</a></td> </tr> } </table> </div> <figure class="meta__image" style="background-image: url('@_data.Image');"></figure> </aside> </div> @if (category != null) { <nav class="detailnav"> @{ var indx = category.Children.FindIndex(c => c.ID.Equals(Pageview.Page.ID)); if (indx.Equals(-1)) { indx = category.Children.FindIndex(c => c.ID.Equals(Pageview.Page.Parent.ID)); } var prevpage = (indx > 0) ? category.Children[indx - 1] : null; var nextpage = ((indx + 1) < category.Children.Count) ? category.Children[indx + 1] : null; if (prevpage != null) { <a href="/Default.aspx?ID=@prevpage.ID" class="detailnav__back"></a> } <a href="/Default.aspx?ID=@category.ID" class="detailnav__overview">Naar overzicht</a> if (nextpage != null) { <a href="/Default.aspx?ID=@nextpage.ID" class="detailnav__next"></a> } } </nav> } </section> @GetValue("DwContent(content)") @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb; @{ var newsletterid = GetInteger("Item.Area.NewsletterSubscribeParagraph"); if (newsletterid > 0) { @RenderParagraphContent(newsletterid) } } <footer class="footer"> <section class="footer__middle container"> <div class="row"> <div class="col-md-6"> @{ var footertitle = GetString("Item.Area.FooterContent_Title"); var footerimg = GetString("Item.Area.FooterContent_Image"); var footertext = GetString("Item.Area.FooterContent_Text"); } <h4 class="footer__subtitle">@footertitle</h4> <div class="row"> <div class="col-md-4"> <img src="@footerimg" class="footer__img"> </div> <div class="col-md-5">@footertext</div> </div> </div> <div class="col-md-6"> <nav class="footer-nav row"> @GetValue("DwNavigation(footernavigation)") </nav> </div> </div> </section> <section class="footer__bottom container"> <div class="row"> <div class="footer__social col-xs-12 col-sm-6 col-lg-2"> @{ var fb = GetString("Item.Area.Facebook"); var twitter = GetString("Item.Area.Twitter"); var instagram = GetString("Item.Area.Instagram"); if (!string.IsNullOrWhiteSpace(fb)) { <a href="@fb" target="_blank" title="Facebook" class="footer__sociallink footer__sociallink--fb"> <img src="/Files/Templates/Designs/Alkmaar%20Marketing/img/socialmedia__icon--facebook.png"> </a> } if (!string.IsNullOrWhiteSpace(twitter)) { <a href="@twitter" target="_blank" title="Twitter" class="footer__sociallink footer__sociallink--twitter"> <img src="/Files/Templates/Designs/Alkmaar%20Marketing/img/socialmedia__icon--twitter.png"> </a> } if (!string.IsNullOrWhiteSpace(instagram)) { <a href="@instagram" target="_blank" title="Instagram" class="footer__sociallink footer__sociallink--ig"> <img src="/Files/Templates/Designs/Alkmaar%20Marketing/img/socialmedia__icon--instagram.png"> </a> } } </div> <div class="wifi col-xs-12 col-sm-6 col-lg-5"> <img src="/Files/Templates/Designs/Alkmaar%20Marketing/img/icon__wifi.png" class="wifi__img"> <span class="wifi__content">@GetString("Item.Area.WIFI")</span> </div> <nav class="legal col-xs-12 col-lg-5"> @GetValue("DwNavigation(bottomnavigation)") </nav> </div> </section> </footer> @RenderSnippet("AddThis") @*<script src="//maps.googleapis.com/maps/api/js"></script>*@ <script type="text/javascript" src="/Files/Templates/Designs/Alkmaar%20Marketing/dist/js/main.min.js"></script> @*renderRichSnippet()*@ </body> </html> @helper renderRichSnippet() { <script type="application/ld+json"> [{ "@@context": "http://schema.org", "@@type": "Organization", "name" : "@GetString("DwAreaName")", "url": "@Base.GetHttpDomain()", "sameAs" : "@GetString("Item.Area.Facebook")", "logo": "/Files/Templates/Designs/Alkmaar Marketing/img/logo.png", "contactPoint" : [{ "@@type" : "ContactPoint", "telephone" : "@GetString("Item.Area.Phonenumber")", "contactType" : "customer service" , "@@context": "http://schema.org", "@@type": "ContactPoint", "@@id": "@Base.GetHttpDomain()", "name": "@GetString("DwAreaName")", "url": "@Base.GetHttpDomain()" }], "address": { "@@type": "PostalAddress", "streetAddress": "@GetString("Item.Area.StreetAddress")", "addressLocality": "@GetString("Item.Area.AddressLocality")", "addressRegion": "@GetString("Item.Area.AddressRegion")", "postalCode": " @GetString("Item.Area.PostalCode")", "addressCountry": "@GetString("Item.Area.AddressCountry")" } }, { "@@context": "http://schema.org", "@@type": "WebSite", "name" : "@GetString("DwAreaName")", "alternateName" : "Alkmaar Marketing", "url": "@Base.GetHttpDomain()", "potentialAction": { "@@type": "SearchAction", "target": " /default.aspx?id=@GetString("Item.Area.SearchPage")&q={search_term_string}", "query-input": "required name=search_term_string" } }] </script> }