Error executing template "/Designs/Soroto/Paragraph/paragraph-with-layout.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_c9d147951c544a73a51e3104799f9248.Execute() in E:\dynamicweb.net\Solutions\FlexMedia\soroto2020.dw9.dynamicweb-cms.com\files\Templates\Designs\Soroto\Paragraph\paragraph-with-layout.cshtml:line 44
   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 @{ 2 3 var container = ""; 4 var paralax = ""; 5 if (!GetBoolean("Item.FullWidth")){ container = "container";} else { container = "fullwidth";} 6 if (!GetBoolean("Item.Paralax")){ paralax = "";} else { paralax = "paralax";} 7 } 8 9 10 <div id='block-block-@GetValue("ParagraphID")' class="paragraph"> 11 12 13 14 @helper DisplayContent(){ 15 16 @GetValue("Item.Content") 17 18 if (@GetString("Item.ReadMoreText")!="") { 19 <a class="read-more" href='@GetValue("Item.ReadMoreLink")'>@GetValue("Item.ReadMoreText")</a> 20 } 21 22 23 24 } 25 26 @helper DisplayVideo(){ 27 28 <iframe width="560" height="315" src='https://www.youtube.com/embed/@GetValue("Item.YoutubeVideo")?rel=0&amp;controls=0&amp;showinfo=0' frameborder="0" allowfullscreen></iframe> 29 } 30 31 @helper DisplayImage(){ 32 <img src='/Admin/Public/GetImage.ashx?Image=@GetValue("Item.Image")&Format=jpg&Width=882&Height=0&Compression=62&Crop=0' alt='@GetValue("Item.Alt")'> 33 } 34 35 36 37 38 39 40 <div class="@container"> 41 <div class="row"> 42 43 44 @if (@GetValue("Item.Layout").ToString() == "1"){ 45 46 <div class="col-12 col-md-6 block-content"> 47 <h4>@GetValue("Item.Subtitle")</h4> 48 <h3>@GetValue("Item.Header")</h3> 49 <div>@DisplayContent()</div> 50 </div> 51 <div class="col-12 col-md-6 block-image">@DisplayImage()</div> 52 } 53 else if (@GetValue("Item.Layout").ToString() == "2") { 54 <div class="block-fullwidth block-image-background @paralax" style='background-image:url("@GetValue("Item.Image")")'> 55 <div class="container"> 56 <div class="row"> 57 <div class="col-12 col-md-8"> 58 <h3>@GetValue("Item.Header")</h3> 59 @DisplayContent() 60 </div> 61 </div> 62 </div> 63 </div> 64 <div class="text-bottom"><h4>@GetValue("Item.Subtitle")</h4></div> 65 } 66 67 else if (@GetValue("Item.Layout").ToString() == "3"){ 68 <div class="background-image2 @paralax" style='background-image:url("@GetValue("Item.Image")")'> 69 <div class="block-map block-image-background" style='background-image:url("@GetValue("Item.Image_2")")'> 70 <div class="container"> 71 <div class="row"> 72 <div id="counter" class="col-12 col-sm-8 col-md-6 block-container"> 73 <div class="map-number counter-value" data-count='@GetValue("Item.Counter")'><p>0</p></div> 74 <h3>@GetValue("Item.Subtitle")</h3> 75 </div> 76 </div> 77 </div> 78 </div> 79 </div> 80 81 <script> 82 var a = 0; 83 $(window).scroll(function() { 84 85 var oTop = $('#counter').offset().top - window.innerHeight; 86 if (a == 0 && $(window).scrollTop() > oTop) { 87 $('.counter-value').each(function() { 88 var $this = $(this), 89 countTo = $this.attr('data-count'); 90 $({ 91 countNum: $this.text() 92 }).animate({ 93 countNum: countTo 94 }, 95 96 { 97 98 duration: 2000, 99 easing: 'swing', 100 step: function() { 101 $this.text(Math.floor(this.countNum)); 102 }, 103 complete: function() { 104 $this.text(this.countNum); 105 //alert('finished'); 106 } 107 108 }); 109 }); 110 a = 1; 111 } 112 113 }); 114 </script> 115 } 116 117 118 119 else if (@GetValue("Item.Layout").ToString() == "4"){ 120 <div class="block-fullwidth block-image-background @paralax" style='background-image:url("@GetValue("Item.Image")")'> 121 <div class="container"> 122 <div class="row"> 123 <div class="col-12 col-md-8"> 124 <h3>@GetValue("Item.Header")</h3> 125 @DisplayContent() 126 </div> 127 </div> 128 </div> 129 </div> 130 <div class="mobile-show" style='background-image:url("@GetValue("Item.Image")")'> 131 </div> 132 <div class="text-bottom"><h4>@GetValue("Item.Subtitle")</h4></div> 133 } 134 else if (@GetValue("Item.Layout").ToString() == "5"){ 135 136 <div class="layout-background-video col-12">@DisplayVideo() 137 <div class="layout-background-video-content col-12"> 138 <div> 139 <h3>@GetValue("Item.Title")</h3> 140 </div> 141 @DisplayContent()</div> 142 </div> 143 144 } 145 146 else { 147 <div>@DisplayContent()</div> 148 <div>@DisplayVideo()</div> 149 <div>@DisplayImage()</div> 150 } 151 152 153 </div> 154 </div> 155 </div>