Exception in template (Designs/Vestjylland/_parsed/Frontpage.parsed.cshtml): System.FormatException: String was not recognized as a valid DateTime.
   at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.Convert.ToDateTime(String value)
   at CompiledRazorTemplates.Dynamic.afddeaaecfcb.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, DynamicViewBag viewBag, String cacheName)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Content @{ string logo = GetString("Item.Area.Logo"); string logoWhite = GetString("Item.Area.LogoHvid"); string email = GetString("Item.Area.Email"); var cookieLevel = Dynamicweb.Environment.CookieManager.GetCookieOptInLevel(); bool cookieSet = Dynamicweb.Environment.CookieManager.CookieOptInLevelExists; bool cookiemanagementActive = Dynamicweb.Environment.CookieManager.IsCookieManagementActive; bool showCookieBar = false; if (cookieSet == false && cookiemanagementActive == true) { cookieLevel = Dynamicweb.Environment.CookieOptInLevel.All; showCookieBar = true; } } <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>@GetValue("Title")</title> @GetValue("MetaTags") @GetValue("CopyRightNotice") @if (string.IsNullOrWhiteSpace(GetString("Item.Area.CustomCssURL"))) { <link rel="shortcut icon" href="/Files/Images/icons/fav.ico"> <link href="https://fonts.googleapis.com/css?family=Muli:300,400,700,900" rel="stylesheet"> <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-LRlmVvLKVApDVGuspQFnRQJjkv0P7/YFrw84YYQtmYG4nK8c+M+NlmYDCv0rKWpG" crossorigin="anonymous"> <link rel="stylesheet" href="/Files/Templates/Designs/Vestjylland/webroot/css/styles.min.css"> } else { @("<" + "link")@: rel="stylesheet" href='@GetString("Item.Area.CustomCssURL")' @("/>") } @RenderSnippet("StyleSheet") @RenderSnippet("JavaScript") <!-- Google Tag Manager --> <script> var cookieOptinLevel = "@cookieLevel"; (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-KRL8HGV'); </script> <!-- End Google Tag Manager --> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KRL8HGV" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> @GetValue("Stylesheets") @GetValue("Javascripts") </head> <body> <div id="page-overlay"></div> @using System; @using System.IO; @using System.Web; @using Dynamicweb.Content.Items; @using Vestjylland.Helpers; @{ string facebookLink = GetString("Item.Area.Facebook"); string linkedInLink = GetString("Item.Area.LinkedIn"); string globalPhone = GetString("Item.Area.Telefon"); string globalEmail = GetString("Item.Area.Email"); string globalNoticeDateFrom = GetString("Item.Area.BeskedVisesFra"); string globalNoticeDateTo = GetString("Item.Area.BeskedVisesTil"); string globalNoticeText = GetString("Item.Area.BeskedTekst"); StreamReader sr = new StreamReader(HttpContext.Current.Server.MapPath(logo)); StreamReader sr2 = new StreamReader(HttpContext.Current.Server.MapPath(logoWhite)); string logoSvg = sr.ReadToEnd(); string logoSvg2 = sr2.ReadToEnd(); sr.Close(); } <nav class="navbar navbar--main navbar-expand-xl navbar-light sticky"> <div class="navbar--main--top"> <a class="navbar-brand" href="/"> <div id="logo-blue"> @logoSvg </div> <div id="logo-white" style="display: none;"> @logoSvg2 </div> </a> <ul class="navbar-nav navbar--contact d-none"> <li class="nav-item"> <a class="nav-link" href="tel:@globalPhone"><i class="fas fa-phone mx-2"></i>@globalPhone</a> </li> <li class="nav-item"> <a class="nav-link" href="mailto:@globalEmail"><i class="fas fa-envelope mx-2"></i>Skriv til os</a> </li> </ul> <button class="navbar-toggler" type="button"> <span class="navbar-toggler-icon far fa-bars"></span> </button> </div> <div class="collapse navbar-collapse" id="navbarNav"> @GetValue("DwNavigation(dwnavlocalbottom)") <ul class="navbar-nav navbar-nav__contact"> <li class="nav-item"> <div class="navbar-nav__contact__wrapper"> <a class="nav-link float-left d-xl-none" href="tel:@globalPhone" target="_blank"><i class="fas fa-phone mx-2"></i></a> <a class="nav-link float-left d-xl-none" href="mailto:@globalEmail"><i class="fas fa-envelope mx-2"></i></a> <a class="nav-link float-left" href="@facebookLink" target="_blank"><i class="fab fa-facebook-f"></i></a> <a class="nav-link float-left" href="@linkedInLink" target="_blank"><i class="fab fa-linkedin-in"></i></a> <a id="headerSearch" class="nav-link float-left header-search d-none d-xl-inline" href="/soeg"> <i class="fas fa-search"></i> <form method="get" action="/soeg"> <input type="text" name="q" placeholder='@Translate("Indtast s&oslash;geord...","Indtast s&oslash;geord...")'> </form> </a> </div> </li> </ul> </div> </nav> @{ Dynamicweb.Content.PageService pageService = new Dynamicweb.Content.PageService(); var pages = pageService.GetPagesByParentID(9); int index = 0; int realIndex = 0; int subElementsCount = 0; int numCols = 4; string elemts = string.Empty; Dictionary<string, int> insurances = new Dictionary<string, int>(); Dictionary<int, int> insuranceSubs = new Dictionary<int, int>(); // Get all pages and put them in a sorted dictionary foreach (Dynamicweb.Content.Page page in pages) { if (page.ItemType == "Forsikring") { if (!insurances.ContainsKey(page.MenuText)) { insurances.Add(page.MenuText, page.ID); var subPages = pageService.GetPagesByParentID(page.ID); int subPageCount = 0; if (subPages != null) { foreach (var subPage in subPages) { subPageCount += 1; subElementsCount += 1; } if (subPageCount == 1) { subPageCount += 1; subElementsCount += 1; } } insuranceSubs.Add(page.ID, subPageCount); } } } @*VestjyskMarketing.Helpers.DebugHelper.DumpObject(insurances)*@ int itemsPerCol = Convert.ToInt32(subElementsCount / numCols); Dictionary<int, int> col1 = new Dictionary<int, int>(); Dictionary<int, int> col2 = new Dictionary<int, int>(); Dictionary<int, int> col3 = new Dictionary<int, int>(); Dictionary<int, int> col4 = new Dictionary<int, int>(); Dictionary<int, int> col5 = new Dictionary<int, int>(); int col1Count = 0; int col2Count = 0; int col3Count = 0; int col4Count = 0; int col5Count = 0; foreach (var col in col1) { col1Count += col.Value; } foreach (var col in col2) { col2Count += col.Value; } foreach (var col in col3) { col3Count += col.Value; } foreach (var col in col4) { col4Count += col.Value; } foreach (var col in col5) { col5Count += col.Value; } foreach (var insuranceSub in insuranceSubs) { if ((insuranceSub.Value + col1Count) < itemsPerCol) { col1.Add(insuranceSub.Key, insuranceSub.Value); col1Count += insuranceSub.Value; } else { if (insuranceSub.Value + col2Count < itemsPerCol) { col2.Add(insuranceSub.Key, insuranceSub.Value); col2Count += insuranceSub.Value; } else { if (insuranceSub.Value + col3Count < itemsPerCol) { col3.Add(insuranceSub.Key, insuranceSub.Value); col3Count += insuranceSub.Value; } else { if (insuranceSub.Value + col4Count < itemsPerCol) { col4.Add(insuranceSub.Key, insuranceSub.Value); col4Count += insuranceSub.Value; } else { if (insuranceSub.Value + col5Count < itemsPerCol) { col5.Add(insuranceSub.Key, insuranceSub.Value); col5Count += insuranceSub.Value; } } } } } } <div id="mega-menu" class="mega-menu"> <div class="mega-wrap"> <div class="row"> <div class="col-12"> <div class="mega-column incurences"> <ul class="incurences__ul__level__1"> @{ foreach (var col1Item in col1) { Dynamicweb.Content.Page thisPage = pageService.GetPage(col1Item.Key); var subPages = pageService.GetPagesByParentID(col1Item.Key); <li> <h4 class="mega-heading">@thisPage.MenuText</h4> @if (subPages != null) { <ul class="incurences__ul__level__2"> @foreach (var subPage in subPages) { if (subPage.ItemType == "Forsikring") { var subSubPages = pageService.GetPagesByParentID(subPage.ID); <li> <a href="/Default.aspx?ID=@subPage.ID" title="Gå til @subPage.MenuText"> @subPage.MenuText @{ bool subSubChildren = false; foreach (var subSubPage in subSubPages) { if (subSubPage.ItemType == "Forsikring") { subSubChildren = true; break; } } if (subSubChildren) { <span class="incurences__expand"><i></i></span> } } </a> @if (subSubChildren) { <ul class="incurences__ul__level__3" style="margin-left: 20px;"> @foreach (var subSubPage in subSubPages) { if (subSubPage.ItemType == "Forsikring") { <li><a href="/Default.aspx?ID=@subSubPage.ID" title="Gå til @subSubPage.MenuText">@subSubPage.MenuText</a></li> } } </ul> } </li> } } </ul> } </li> } } </ul> </div> <div class="mega-column incurences"> <ul class="incurences__ul__level__1"> @{ foreach (var col1Item in col2) { Dynamicweb.Content.Page thisPage = pageService.GetPage(col1Item.Key); var subPages = pageService.GetPagesByParentID(col1Item.Key); <li> <h4 class="mega-heading">@thisPage.MenuText</h4> @if (subPages != null) { <ul class="incurences__ul__level__2"> @foreach (var subPage in subPages) { if (subPage.ItemType == "Forsikring") { var subSubPages = pageService.GetPagesByParentID(subPage.ID); <li> <a href="/Default.aspx?ID=@subPage.ID" title="Gå til @subPage.MenuText"> @subPage.MenuText @{ bool subSubChildren = false; foreach (var subSubPage in subSubPages) { if (subSubPage.ItemType == "Forsikring") { subSubChildren = true; break; } } if (subSubChildren) { <span class="incurences__expand"><i></i></span> } } </a> @if (subSubChildren) { <ul class="incurences__ul__level__3" style="margin-left: 20px;"> @foreach (var subSubPage in subSubPages) { if (subSubPage.ItemType == "Forsikring") { <li><a href="/Default.aspx?ID=@subSubPage.ID" title="Gå til @subSubPage.MenuText">@subSubPage.MenuText</a></li> } } </ul> } </li> } } </ul> } </li> } } </ul> </div> <div class="mega-column incurences"> <ul class="incurences__ul__level__1"> @{ foreach (var col1Item in col3) { Dynamicweb.Content.Page thisPage = pageService.GetPage(col1Item.Key); var subPages = pageService.GetPagesByParentID(col1Item.Key); <li> <h4 class="mega-heading">@thisPage.MenuText</h4> @if (subPages != null) { <ul class="incurences__ul__level__2"> @foreach (var subPage in subPages) { if (subPage.ItemType == "Forsikring") { var subSubPages = pageService.GetPagesByParentID(subPage.ID); <li> <a href="/Default.aspx?ID=@subPage.ID" title="Gå til @subPage.MenuText"> @subPage.MenuText @{ bool subSubChildren = false; foreach (var subSubPage in subSubPages) { if (subSubPage.ItemType == "Forsikring") { subSubChildren = true; break; } } if (subSubChildren) { <span class="incurences__expand"><i></i></span> } } </a> @if (subSubChildren) { <ul class="incurences__ul__level__3" style="margin-left: 20px;"> @foreach (var subSubPage in subSubPages) { if (subSubPage.ItemType == "Forsikring") { <li><a href="/Default.aspx?ID=@subSubPage.ID" title="Gå til @subSubPage.MenuText">@subSubPage.MenuText</a></li> } } </ul> } </li> } } </ul> } </li> } } </ul> </div> <div class="mega-column incurences"> <ul class="incurences__ul__level__1"> @{ foreach (var col1Item in col4) { Dynamicweb.Content.Page thisPage = pageService.GetPage(col1Item.Key); var subPages = pageService.GetPagesByParentID(col1Item.Key); <li> <h4 class="mega-heading">@thisPage.MenuText</h4> @if (subPages != null) { <ul class="incurences__ul__level__2"> @foreach (var subPage in subPages) { if (subPage.ItemType == "Forsikring") { var subSubPages = pageService.GetPagesByParentID(subPage.ID); <li> <a href="/Default.aspx?ID=@subPage.ID" title="Gå til @subPage.MenuText"> @subPage.MenuText @{ bool subSubChildren = false; foreach (var subSubPage in subSubPages) { if (subSubPage.ItemType == "Forsikring") { subSubChildren = true; break; } } if (subSubChildren) { <span class="incurences__expand"><i></i></span> } } </a> @if (subSubChildren) { <ul class="incurences__ul__level__3" style="margin-left: 20px;"> @foreach (var subSubPage in subSubPages) { if (subSubPage.ItemType == "Forsikring") { <li><a href="/Default.aspx?ID=@subSubPage.ID" title="Gå til @subSubPage.MenuText">@subSubPage.MenuText</a></li> } } </ul> } </li> } } </ul> } </li> } } </ul> </div> <div class="mega-column incurences"> <ul class="incurences__ul__level__1"> @{ foreach (var col1Item in col5) { Dynamicweb.Content.Page thisPage = pageService.GetPage(col1Item.Key); var subPages = pageService.GetPagesByParentID(col1Item.Key); <li> <h4 class="mega-heading">@thisPage.MenuText</h4> @if (subPages != null) { <ul class="incurences__ul__level__2"> @foreach (var subPage in subPages) { if (subPage.ItemType == "Forsikring") { var subSubPages = pageService.GetPagesByParentID(subPage.ID); <li> <a href="/Default.aspx?ID=@subPage.ID" title="Gå til @subPage.MenuText"> @subPage.MenuText @{ bool subSubChildren = false; foreach (var subSubPage in subSubPages) { if (subSubPage.ItemType == "Forsikring") { subSubChildren = true; break; } } if (subSubChildren) { <span class="incurences__expand"><i></i></span> } } </a> @if (subSubChildren) { <ul class="incurences__ul__level__3" style="margin-left: 20px;"> @foreach (var subSubPage in subSubPages) { if (subSubPage.ItemType == "Forsikring") { <li><a href="/Default.aspx?ID=@subSubPage.ID" title="Gå til @subSubPage.MenuText">@subSubPage.MenuText</a></li> } } </ul> } </li> } } </ul> } </li> } } </ul> </div> </div> </div> </div> </div> <div class="nav--height"></div> if (Convert.ToDateTime(globalNoticeDateFrom) <= DateTime.Now && Convert.ToDateTime(globalNoticeDateTo) >= DateTime.Now) { <div class="page--notice-message"> @globalNoticeText </div> } } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> <div id="content">@GetValue("DwContent(content)")</div> <footer class="footer"> <div class="footer__main"> <div class="row"> <div class="col-12 col-sm-4 col-md"> @GetString("Item.Area.FooterKolonne_1") <i class="fas fa-phone mr-2"></i> @globalPhone </div> <div class="col-12 col-sm-4 col-md"> @GetString("Item.Area.FooterKolonne_2") </div> <div class="col-12 col-sm text-center d-none d-xl-flex"> <span class="title">Tæt på</span> </div> <div class="col-12 col-sm-4 col-md"> @GetString("Item.Area.FooterKolonne_3") </div> <div class="col-12 col-lg"> <div class="footer__main__logo"> <a href="/"> <img src="/Files/Templates/Designs/Vestjylland/webroot/img/logo-footer.png" class="img-responsive"> </a> </div> </div> </div> </div> <div class="footer__bottom"> <div class="row"> <div class="footer__bottom__socials"> <a href="@facebookLink" target="_blank"><i class="fab fa-facebook-f mr-3"></i></a> <a href="@linkedInLink" target="_blank"><i class="fab fa-linkedin-in"></i></a> </div> <div class="col-12 col-sm"> @GetString("Item.Area.FooterLinksBund") </div> </div> </div> </footer> <div class="widget d-none d-lg-inline-block"> @{ // Initialize livechat LiveChatHelper liveChat = new LiveChatHelper(); string liveChatImage = liveChat.GetAgentAvatar(); foreach (var item in GetLoop("Item.Area.Sticky")) { string widgetImage = item.GetString("Item.Area.Sticky.Billede"); string widgetTitle = item.GetString("Item.Area.Sticky.Overskrift"); string widgetIcon = item.GetString("Item.Area.Sticky.Ikon"); string widgetBtnText = item.GetString("Item.Area.Sticky.KnapTekst"); string widgetBtnLink = item.GetString("Item.Area.Sticky.KnapLink"); string widgetBtnClick = item.GetString("Item.Area.Sticky.KnapKlik"); string isLiveChat = item.GetString("Item.Area.Sticky.LiveChat"); if (isLiveChat == "True") { if(!string.IsNullOrEmpty(liveChatImage)) { widgetImage = liveChatImage; } } <div class="widget__item"> <div class="float-left"> <img src="@widgetImage" class="img-fluid" style="-webkit-filter: grayscale(1); filter: grayscale(1); height: 70px; width: 70px;"> </div> <div class="ml-3 float-right text-center"> <div class="widget__item__text"> <i class="@widgetIcon mr-1"></i> @widgetTitle </div> @if (!string.IsNullOrEmpty(widgetBtnLink)) { <a href="@widgetBtnLink" class="btn btn-secondary">@widgetBtnText</a> } else { if (!string.IsNullOrEmpty(widgetBtnClick)) { <a href="#" onclick="@widgetBtnClick" class="btn btn-secondary">@widgetBtnText</a> } } </div> </div> } } </div> @if (showCookieBar) { <script type="text/javascript"> function setOptInCookie(optInLevel) { var xmlhttp; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { var div = document.getElementById("cookieWarningDiv"); div.parentNode.removeChild(div); } } xmlhttp.open("GET", "/admin/public/CookieOptInLevelConfig.aspx?cmd=SetCookieOptInLevel&OptInLevel=" + optInLevel, true); xmlhttp.send(); } function setOptInCookieAndRefresh(optInLevel) { setOptInCookie(optInLevel); return false; } </script> <div id="cookieWarningDiv" class="cookie__message"> <div class="container-fluid"> <p> Hjemmesiden bruger cookies. De bruges til trafikmåling og optimering af sidens indhold samt til at målrette markedsføring. Ved at bruge vores hjemmeside, accepterer du vores <a href="/om-vestjylland/behandling-af-persondata"> brug af cookies </a> </p> <p style="margin-top: 10px;"> <a href="javascript:void();" class="CookieOptInLevelConfig btn btn__accept btn-primary" onclick="return setOptInCookieAndRefresh(2);">Accepter alle cookies</a>&nbsp;&nbsp; <a href="javascript:void();" class="CookieOptInLevelConfig btn__functional" onclick="return setOptInCookieAndRefresh(1);">Accepter kun funktionelle cookies</a> </p> </div> </div> } <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css"> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script> <script src="/Files/Templates/Designs/Vestjylland/webroot/js/scripts.min.js"></script> @RenderSnippet("JavaScriptBottom") </body> </html>