Error executing template "Designs/bionordika/Paragraph/Navigation.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_1003f66476e44cea9c294bd3df77dd24.Execute() in D:\dynamicweb.net\Solutions\Co3\bionordika.cloud.dynamicweb-cms.com\Files\Templates\Designs\bionordika\Paragraph\Navigation.cshtml:line 61
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 @using System.IO 2 @using Co3.Espresso.Website.Models.FrontEnd 3 @using Co3.Espresso.Website.Services 4 @using Dynamicweb.Frontend 5 @using Dynamicweb.Security.UserManagement 6 @using Page = Dynamicweb.Content.Page 7 @inherits Co3.Espresso.Website.TemplateBases.Paragraphs.ImageTextTopBottom 8 9 10 11 @{ 12 Espresso.Container.Classes.RemoveClasses( "p-imagetext" ); 13 Espresso.Container.Classes.AddClasses( "p-sitemap p-sitemap-" + Espresso.Item.Layout ); 14 ClassList navigationContainerClassList = new ClassList( "p-sitemap-container p-sitemap-container-" + Espresso.Item.Layout + " d-none d-sm-block" ); 15 ClassList navigationClassList = new ClassList( "justify-content-start nav" ); 16 if ( GetBoolean( "Item.DashboardNavigation" ) == true ) 17 { 18 navigationClassList.AddClasses( "bionordika-user-dashbord-navigation" ); 19 } 20 if ( Espresso.Item.Layout == "vertical" ) 21 { 22 navigationClassList.AddClasses( "flex-column" ); 23 } 24 else if ( Espresso.Item.Layout == "horizontal" ) 25 { 26 navigationContainerClassList.AddClasses( "border" ); 27 } 28 29 int NavigationParentPageId = 0; 30 if ( !string.IsNullOrEmpty( Espresso.Item.ParentPage ) ) 31 { 32 int.TryParse( Espresso.Item.ParentPage, out NavigationParentPageId ); 33 } 34 35 string NavigationTemplate = "local-" + Espresso.Item.Layout + ".xslt"; 36 if ( !string.IsNullOrEmpty( Espresso.Item.Template ) && Path.GetExtension( Espresso.Item.Template ) == ".xslt" ) 37 { 38 NavigationTemplate = Path.GetFileName( Espresso.Item.Template ); 39 } 40 // TODO: This condition is never true after refactoring Responsive widths, fix it 41 if ( Espresso.WidthCustom == -1 && Espresso.ResponsiveInfo.ResponsiveWidths.All( rw => rw.Value.IsAuto ) ) 42 { 43 Espresso.Container.Classes.RemoveClasses( "col-12" ); 44 if ( Espresso.Item.Layout == "vertical" ) 45 { 46 Espresso.Container.Classes.AddClasses( "col-3" ); 47 } 48 else if ( Espresso.Item.Layout == "horizontal" ) 49 { 50 Espresso.Container.Classes.AddClasses( "col-12" ); 51 } 52 } 53 54 55 string passwordChangeUrlParameter = "PasswordChange=True"; // TODO: Move this 56 string profilePage = PageView.Current().Area.Item[ "ExtranetProfilePage" ].ToString(); 57 string dashboardPage = PageView.Current().Area.Item[ "ExtranetDashboardPage" ].ToString(); 58 string userEditPage = PageView.Current().Area.Item[ "ExtranetEditProfilePage" ].ToString(); 59 string editPasswordPage = PageView.Current().Area.Item[ "ExtranetEditPasswordPage" ].ToString(); 60 string impersonationPage = GetString( "Area.Item.ExtranetImpersonationPage" ); 61 string userEmail = User.GetCurrentUser().UserName; 62 string userPhone = string.IsNullOrEmpty( User.GetCurrentUser().Phone ) == false ? User.GetCurrentUser().Phone : string.Empty; 63 64 string userName = string.IsNullOrEmpty( User.GetCurrentUser().UserName ) == true ? User.GetCurrentUser().UserName : User.GetCurrentUser().Name; 65 string[] userNameSplit = userName.ToUpper().Split( new[] { " ", "-" }, StringSplitOptions.RemoveEmptyEntries ); 66 string userInitials = string.Empty; 67 68 foreach ( string item in userNameSplit ) 69 { 70 if ( string.IsNullOrEmpty( item ) == false && string.IsNullOrWhiteSpace( item ) == false ) 71 { 72 userInitials += item.Substring( 0, 1 ); 73 if ( userInitials.Length == 3 ) 74 { 75 break; 76 } 77 } 78 } 79 80 } 81 <div class="@Espresso.Container.Classes" id="@Espresso.Id"> 82 83 @if ( GetBoolean( "Item.DashboardNavigation" ) == true ) 84 { 85 <div class="bionordika-user-dashbord-navigation-profil-card"> 86 <div class="bionordika-user-dashbord-navigation-profil-card-icon" data-initials="@userInitials"> 87 @if ( string.IsNullOrEmpty( dashboardPage ) == false ) 88 { 89 <a href="@dashboardPage"></a> 90 } 91 </div> 92 93 <div class="bionordika-user-dashbord-navigation-profil-card-details"> 94 <ul> 95 <li> 96 <h3> 97 @if ( string.IsNullOrEmpty( dashboardPage ) == false ) 98 { 99 <a href="@dashboardPage">@userName</a> 100 } 101 else 102 { 103 @userName 104 } 105 </h3> 106 </li> 107 @if ( string.IsNullOrEmpty( userEmail ) == false ) 108 { 109 <li>@userEmail</li> 110 } 111 @if ( string.IsNullOrEmpty( userPhone ) == false ) 112 { 113 <li>@userPhone</li> 114 } 115 </ul> 116 </div> 117118 </div> 119120 <div class="bionordika-user-dashbord-navigation-collapsible" id="bionordikaDashBoardNavigation"> 121 <div class="card"> 122 <div class="card-header" id="headingOne"> 123 <h4 aria-controls="expandContainer" aria-expanded="true" class="collapse-toggle collapsed" data-target="#expandContainer" data-toggle="collapse"> 124 @Translate( "Extranet View Page - Nav Shortcut - Text", "Mine genveje" ) <i class="e-icon ml-1">@ImageService.Instance.GetSvgMarkup( "/Files/Images/icons/general/arrow-down.SVG" )</i> 125 </h4> 126 </div> 127128 <div aria-labelledby="headingOne" class="collapse" data-parent="#bionordikaDashBoardNavigation" id="expandContainer"> 129 <div class="card-body"> 130 <ul class="@navigationClassList bionordika-user-dashbord-navigation"> 131 @RenderNavigation( new 132 { 133 id = "dwnav-p-sitemap-" + Espresso.Id, 134 parentid = NavigationParentPageId, 135 template = NavigationTemplate, 136 startlevel = Espresso.Item.LevelStart, 137 endlevel = Espresso.Item.LevelEnd, 138 expandmode = Espresso.Item.ExpandMode, 139 sitemapmode = NavigationParentPageId == 0 ? true : false 140 } ) 141 </ul> 142 </div> 143 </div> 144 </div> 145 </div> 146147 <div class="bionordika-user-dashbord-navigation-profil-card-links"> 148 <ul> 149 @if ( string.IsNullOrEmpty( userEditPage ) == false ) 150 { 151 <li> 152 <a class="btn btn-block btn-primary" href="@userEditPage"> 153 <span>@Translate( "Extranet View Page - Edit profile - Text", "Rediger profil" )</span> 154 </a> 155 </li> 156 } 157 @if ( string.IsNullOrEmpty( editPasswordPage ) == false ) 158 { 159 <li> 160 <a class="btn btn-block btn-primary" href="@editPasswordPage"> 161 <span>@Translate( "Extranet View Page - Edit password - Text", "Rediger adgangskode" )</span> 162 </a> 163 </li> 164 } 165 </ul> 166 </div> 167 } 168169 <nav class="@navigationContainerClassList" id="dwnav-p-sitemap-@Espresso.Id"> 170 <ul class="@navigationClassList"> 171 @if ( Espresso.Item.BackLinkShow == "True" ) 172 { 173 <li class="e-nav-local-back-link m-0 p-0"> 174 <a class="arrow-left nav-link py-1 text-link" href="@Espresso.Item.BackLinkHref"> 175 <span class="e-nav-pagename small">@Espresso.Item.BackLinkText</span> 176 </a> 177 </li> 178 } 179 @if ( Espresso.Item.Heading != "" ) 180 { 181 <li class="p-sitemap-heading"> 182 <h2>@Espresso.Item.Heading</h2> 183 </li> 184 } 185 @RenderNavigation( new 186 { 187 id = "dwnav-p-sitemap-" + Espresso.Id, 188 parentid = NavigationParentPageId, 189 template = NavigationTemplate, 190 startlevel = Espresso.Item.LevelStart, 191 endlevel = Espresso.Item.LevelEnd, 192 expandmode = Espresso.Item.ExpandMode, 193 sitemapmode = NavigationParentPageId == 0 ? true : false 194 } ) 195 </ul> 196 </nav> 197 </div> 198