Error executing template "Designs/Jks2022/Paragraph/FiftyFiftyEntry.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_503e0cb520004d99b3fa60208fd1dfb5.Execute() in D:\Web\jks\Website\Files\Templates\Designs\Jks2022\Paragraph\FiftyFiftyEntry.cshtml:line 19
   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 Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Jks.Helpers; 3 4 @{ 5 var imageObj = Model.Item.GetFile("Image"); 6 string image = "/Admin/Public/GetImage.ashx?Image={0}&Format=webP&width={1}&Height={2}&Quality={3}"; 7 bool doNotResize = Model.Item.GetBoolean("Do_Not_Resize"); 8 string doNotResizeClass = null; 9 bool hideImageOnMobile = Model.Item.GetBoolean("hideImageOnMobile") && Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Mobile; 10 11 var imageAlt = Model.Item.GetString("ImageAlt"); 12 13 if (imageObj != null && imageObj.HasFocalPoint()) 14 { 15 image += "&x=" + imageObj.FocalX + "&y=" + imageObj.FocalY; 16 } 17 if (doNotResize) 18 { 19 image = Model.Item.GetFile("Image").Path; 20 doNotResizeClass = "entry-picture__no-resize"; 21 } 22 else 23 { 24 int imageQuality = Model.Item.GetInt32("ImageQuality") > 0 ? Model.Item.GetInt32("ImageQuality") : 75; 25 string imageSize = Model.Item.GetString("ImageSize"); 26 int imageWidth = 1000; 27 int imageHeight = 600; 28 if (imageSize == "large") 29 { 30 imageWidth = 1500; 31 imageHeight = 900; 32 } 33 else if (imageSize == "x-large") 34 { 35 imageWidth = 2000; 36 imageHeight = 1500; 37 } 38 if (Model.Item.GetFile("Image") != null) 39 { 40 image = String.Format(image, Model.Item.GetFile("Image").Path, imageWidth, imageHeight, imageQuality); 41 } 42 } 43 44 45 var settings = Model.Item.GetItem("Settings"); 46 var content = Model.Item.GetItem("Content"); 47 string bgColorClass = settings.GetString("BackgroundColor"); 48 string headlineElementType = settings.GetString("HeadlineElementType"); 49 50 string boxType = !String.IsNullOrEmpty(Model.Item.GetString("BoxType")) ? Model.Item.GetString("BoxType") : "standard"; 51 string imagePosition = !String.IsNullOrEmpty(Model.Item.GetString("ImagePosition")) ? Model.Item.GetString("ImagePosition") : "left"; 52 53 string paddingClassesContent = !String.IsNullOrEmpty(Model.Item.GetString("PaddingContent")) ? "pt-rem-xxl-" + Model.Item.GetString("PaddingContent") + " pb-rem-xxl-" + Model.Item.GetString("PaddingContent") : ""; 54 string containerClass = String.Empty; 55 string rowClass = String.Empty; 56 string pictureWrapperClass = String.Empty; 57 string textWrapperClass = String.Empty; 58 string entryClass = String.Empty; 59 60 if (boxType == "fullpicture_bigimage") 61 { 62 entryClass = "entry-picture-large"; 63 containerClass = "container-padding-mobile"; 64 rowClass = "m-0"; 65 pictureWrapperClass = "ps-0 col-12 col-lg-6 col-xl-7"; 66 textWrapperClass = "col-12 col-lg-5 offset-lg-1 col-xl-3 entry-picture__text-wrapper"; 67 } 68 else if (boxType == "fullpicture_falldown") 69 { 70 image = "/Admin/Public/GetImage.ashx?Image=" + Model.Item.GetFile("Image") + "&Crop=0&Format=webP&width=835&Height=745&Compression=75"; //reset image details 71 entryClass = "entry-picture--image-glide"; 72 containerClass = "container-fluid"; 73 pictureWrapperClass = "col-12 col-lg-6 col-xl-6"; 74 textWrapperClass = "col-12 col-lg-5 offset-lg-1 col-xl-4 col-xxl-3 entry-picture__text-wrapper mb-5 mb-lg-0"; 75 } 76 else 77 { 78 entryClass = "entry-picture-large"; 79 containerClass = "container-fluid container-fluid-extra"; 80 textWrapperClass = "col-12 col-lg-5 col-xl-4 entry-picture__text-wrapper"; 81 pictureWrapperClass = "col-12 col-lg-6 col-xl-7"; 82 if (imagePosition == "right") 83 { 84 pictureWrapperClass += " offset-lg-1"; 85 } 86 else 87 { 88 textWrapperClass += " offset-lg-1"; 89 } 90 } 91 92 if (imagePosition == "right") 93 { 94 rowClass += " flex-row-reverse"; 95 } 96 97 bool readMoreButton = Model.Item.GetBoolean("ReadMoreButton"); 98 var spacingClasses = Jks.Helpers.Spacing.SpacingClassContainer(settings); 99 string buttonClass = !String.IsNullOrEmpty(Model.Item.GetString("ButtonColor")) ? Model.Item.GetString("ButtonColor") : "btn-primary btn-transparant"; 100 } 101 <div class="@containerClass @bgColorClass @spacingClasses.Margin xl-skip"> 102 <section class="entry-picture @entryClass @spacingClasses.Padding"> 103 <div class="row @rowClass"> 104 @if (imageObj != null && !String.IsNullOrEmpty(imageObj.ToString()) && !hideImageOnMobile) 105 { 106 <div class="entry-picture__image-wrapper @pictureWrapperClass flex-column justify-content-center"> 107 <div class="position-relative h-100"> 108 <img class="entry-picture__image img-fluid w-100 @doNotResizeClass" src="@image" alt="@imageAlt" /> 109 110 @if (!String.IsNullOrEmpty(Model.Item.GetString("VideoLink"))) 111 { 112 113 <div class="entry-picture__image-wrapper__play-wrapper"> 114 <div class="entry-picture__image-wrapper__play-wrapper__overlay"></div> 115 <div class="entry-picture__image-wrapper__play-wrapper__play"> 116 <a href="@Model.Item.GetString("VideoLink")" class="js-watch-video entry-picture__image-wrapper__play-wrapper__play__text">@Translate("Watch video")</a> 117 </div> 118 </div> 119 120 } 121 </div> 122 </div> 123 } 124 <div class="@textWrapperClass @paddingClassesContent d-flex flex-column justify-content-center"> 125 126 @content.GetString("Title").OutputHeadline(headlineElementType, false, "h2", "entry-picture__header") 127 128 <div class="entry-picture__text @if (readMoreButton) {<text>js-readmore-text</text>}"> 129 @content.GetString("SubTitle") 130 </div> 131 132 @if (readMoreButton) 133 { 134 <a href="javascript:void(0)" data-toggletext="@Translate("Read less")" class="js-readmore btn-arrow mt-3 mb-md-3 mb-lg-0"> 135 @Translate("Read more") 136 </a> 137 } 138 else 139 { 140 if (!String.IsNullOrEmpty(content.GetString("LinkText")) && !String.IsNullOrEmpty(content.GetString("Link"))) 141 { 142 <div> 143 <a href="@content.GetString("Link")" class="btn @buttonClass mt-3"> 144 @content.GetString("LinkText") 145 </a> 146 </div> 147 } 148 } 149 </div> 150 </div> 151 </section> 152 </div>
Error executing template "Designs/Jks2022/Paragraph/FiftyFiftyEntry.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_503e0cb520004d99b3fa60208fd1dfb5.Execute() in D:\Web\jks\Website\Files\Templates\Designs\Jks2022\Paragraph\FiftyFiftyEntry.cshtml:line 19
   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 Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Jks.Helpers; 3 4 @{ 5 var imageObj = Model.Item.GetFile("Image"); 6 string image = "/Admin/Public/GetImage.ashx?Image={0}&Format=webP&width={1}&Height={2}&Quality={3}"; 7 bool doNotResize = Model.Item.GetBoolean("Do_Not_Resize"); 8 string doNotResizeClass = null; 9 bool hideImageOnMobile = Model.Item.GetBoolean("hideImageOnMobile") && Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Mobile; 10 11 var imageAlt = Model.Item.GetString("ImageAlt"); 12 13 if (imageObj != null && imageObj.HasFocalPoint()) 14 { 15 image += "&x=" + imageObj.FocalX + "&y=" + imageObj.FocalY; 16 } 17 if (doNotResize) 18 { 19 image = Model.Item.GetFile("Image").Path; 20 doNotResizeClass = "entry-picture__no-resize"; 21 } 22 else 23 { 24 int imageQuality = Model.Item.GetInt32("ImageQuality") > 0 ? Model.Item.GetInt32("ImageQuality") : 75; 25 string imageSize = Model.Item.GetString("ImageSize"); 26 int imageWidth = 1000; 27 int imageHeight = 600; 28 if (imageSize == "large") 29 { 30 imageWidth = 1500; 31 imageHeight = 900; 32 } 33 else if (imageSize == "x-large") 34 { 35 imageWidth = 2000; 36 imageHeight = 1500; 37 } 38 if (Model.Item.GetFile("Image") != null) 39 { 40 image = String.Format(image, Model.Item.GetFile("Image").Path, imageWidth, imageHeight, imageQuality); 41 } 42 } 43 44 45 var settings = Model.Item.GetItem("Settings"); 46 var content = Model.Item.GetItem("Content"); 47 string bgColorClass = settings.GetString("BackgroundColor"); 48 string headlineElementType = settings.GetString("HeadlineElementType"); 49 50 string boxType = !String.IsNullOrEmpty(Model.Item.GetString("BoxType")) ? Model.Item.GetString("BoxType") : "standard"; 51 string imagePosition = !String.IsNullOrEmpty(Model.Item.GetString("ImagePosition")) ? Model.Item.GetString("ImagePosition") : "left"; 52 53 string paddingClassesContent = !String.IsNullOrEmpty(Model.Item.GetString("PaddingContent")) ? "pt-rem-xxl-" + Model.Item.GetString("PaddingContent") + " pb-rem-xxl-" + Model.Item.GetString("PaddingContent") : ""; 54 string containerClass = String.Empty; 55 string rowClass = String.Empty; 56 string pictureWrapperClass = String.Empty; 57 string textWrapperClass = String.Empty; 58 string entryClass = String.Empty; 59 60 if (boxType == "fullpicture_bigimage") 61 { 62 entryClass = "entry-picture-large"; 63 containerClass = "container-padding-mobile"; 64 rowClass = "m-0"; 65 pictureWrapperClass = "ps-0 col-12 col-lg-6 col-xl-7"; 66 textWrapperClass = "col-12 col-lg-5 offset-lg-1 col-xl-3 entry-picture__text-wrapper"; 67 } 68 else if (boxType == "fullpicture_falldown") 69 { 70 image = "/Admin/Public/GetImage.ashx?Image=" + Model.Item.GetFile("Image") + "&Crop=0&Format=webP&width=835&Height=745&Compression=75"; //reset image details 71 entryClass = "entry-picture--image-glide"; 72 containerClass = "container-fluid"; 73 pictureWrapperClass = "col-12 col-lg-6 col-xl-6"; 74 textWrapperClass = "col-12 col-lg-5 offset-lg-1 col-xl-4 col-xxl-3 entry-picture__text-wrapper mb-5 mb-lg-0"; 75 } 76 else 77 { 78 entryClass = "entry-picture-large"; 79 containerClass = "container-fluid container-fluid-extra"; 80 textWrapperClass = "col-12 col-lg-5 col-xl-4 entry-picture__text-wrapper"; 81 pictureWrapperClass = "col-12 col-lg-6 col-xl-7"; 82 if (imagePosition == "right") 83 { 84 pictureWrapperClass += " offset-lg-1"; 85 } 86 else 87 { 88 textWrapperClass += " offset-lg-1"; 89 } 90 } 91 92 if (imagePosition == "right") 93 { 94 rowClass += " flex-row-reverse"; 95 } 96 97 bool readMoreButton = Model.Item.GetBoolean("ReadMoreButton"); 98 var spacingClasses = Jks.Helpers.Spacing.SpacingClassContainer(settings); 99 string buttonClass = !String.IsNullOrEmpty(Model.Item.GetString("ButtonColor")) ? Model.Item.GetString("ButtonColor") : "btn-primary btn-transparant"; 100 } 101 <div class="@containerClass @bgColorClass @spacingClasses.Margin xl-skip"> 102 <section class="entry-picture @entryClass @spacingClasses.Padding"> 103 <div class="row @rowClass"> 104 @if (imageObj != null && !String.IsNullOrEmpty(imageObj.ToString()) && !hideImageOnMobile) 105 { 106 <div class="entry-picture__image-wrapper @pictureWrapperClass flex-column justify-content-center"> 107 <div class="position-relative h-100"> 108 <img class="entry-picture__image img-fluid w-100 @doNotResizeClass" src="@image" alt="@imageAlt" /> 109 110 @if (!String.IsNullOrEmpty(Model.Item.GetString("VideoLink"))) 111 { 112 113 <div class="entry-picture__image-wrapper__play-wrapper"> 114 <div class="entry-picture__image-wrapper__play-wrapper__overlay"></div> 115 <div class="entry-picture__image-wrapper__play-wrapper__play"> 116 <a href="@Model.Item.GetString("VideoLink")" class="js-watch-video entry-picture__image-wrapper__play-wrapper__play__text">@Translate("Watch video")</a> 117 </div> 118 </div> 119 120 } 121 </div> 122 </div> 123 } 124 <div class="@textWrapperClass @paddingClassesContent d-flex flex-column justify-content-center"> 125 126 @content.GetString("Title").OutputHeadline(headlineElementType, false, "h2", "entry-picture__header") 127 128 <div class="entry-picture__text @if (readMoreButton) {<text>js-readmore-text</text>}"> 129 @content.GetString("SubTitle") 130 </div> 131 132 @if (readMoreButton) 133 { 134 <a href="javascript:void(0)" data-toggletext="@Translate("Read less")" class="js-readmore btn-arrow mt-3 mb-md-3 mb-lg-0"> 135 @Translate("Read more") 136 </a> 137 } 138 else 139 { 140 if (!String.IsNullOrEmpty(content.GetString("LinkText")) && !String.IsNullOrEmpty(content.GetString("Link"))) 141 { 142 <div> 143 <a href="@content.GetString("Link")" class="btn @buttonClass mt-3"> 144 @content.GetString("LinkText") 145 </a> 146 </div> 147 } 148 } 149 </div> 150 </div> 151 </section> 152 </div>

Motta en samtale

---

KONTAKT

FORMULAR

---

Kontakt oss

Vores medarbejdere

Martin Skaug

Regionleder øst

Benjamin Decker

Driftsleder

Ida Hestnes

Avdelingsleder Trondheim

Björn Bernhardsson

Chief Revenue Officer

Dominika Kovalova

Rådgiver

Natalija Greben

Rådgiver

Wilma Stensby van der Laak

Rådgiver