Error executing template "/Designs/Rapido/Paragraph/Custom_CategoryList.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_2641891e66474633b4616a19d64b4b45.Execute() in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\Paragraph\Custom_CategoryList.cshtml:line 26
   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.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb.Ecommerce.Products; 3 @using System.Web; 4 5 @{ 6 string url = HttpContext.Current.Request.Url.AbsoluteUri; 7 var uri = new Uri(url); 8 var query = HttpUtility.ParseQueryString(uri.Query); 9 var groupId = query.Get("CategoryId"); 10 var groupPageId = GetPageIdByNavigationTag("ProductsPageCategories"); 11 12 string promImage = ""; 13 string promLink = ""; 14 string promLinkText = ""; 15 string promHeader = ""; 16 string promHeaderSize = ""; 17 string promHeaderColor = ""; 18 string promParagraphHeader = ""; 19 string promParagraph = ""; 20 21 Group parentGroup = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(groupId); 22 23 } 24 <div class="category-list-container"> 25 26 <h2>@parentGroup.Name</h2> 27 @foreach (var field in parentGroup.ProductGroupFieldValues) 28 { 29 30 promImage = field.ProductGroupField.SystemName == "ctaImage" ? field.Value.ToString() : promImage; 31 promLink = field.ProductGroupField.SystemName == "ctaLink" ? field.Value.ToString() : promLink; 32 promLinkText = field.ProductGroupField.SystemName == "ctaLinkText" ? field.Value.ToString() : promLinkText; 33 promHeader = field.ProductGroupField.SystemName == "ctaHeader" ? field.Value.ToString() : promHeader; 34 promHeaderSize = field.ProductGroupField.SystemName == "ctaHeaderSize" ? field.Value.ToString() + "px" : promHeaderSize; 35 promHeaderColor = field.ProductGroupField.SystemName == "ctaHeaderColor" ? field.Value.ToString() : promHeaderColor; 36 promParagraphHeader = field.ProductGroupField.SystemName == "ctaParagraphHeader" ? field.Value.ToString() : promParagraphHeader; 37 promParagraph = field.ProductGroupField.SystemName == "ctaParagraph" ? field.Value.ToString() : promParagraph; 38 } 39 40 41 <article class="promotion-container"> 42 <a href="@promImage" class="promotion-banner"> 43 @if (promHeader != "") 44 { 45 <div class="image-overlay"></div> 46 <div style="font-size: @promHeaderSize; color: @promHeaderColor" class="promotion-image-title"> 47 @promHeader 48 </div> 49 } 50 <img class="b-lazy banner-image" data-src="/Admin/Public/GetImage.ashx?Format=webp&width=1250&crop=5&Compression=95&DoNotUpscale=true&image=/Files/Images/@promImage" alt="@parentGroup.Name" /> 51 </a> 52 53 <div class="promotion-paragraph-container"> 54 <div class="promotion-paragraph-header"> 55 @promParagraphHeader 56 </div> 57 <div class="promotion-paragraph"> 58 @promParagraph 59 </div> 60 </div> 61 </article> 62 63 <div class="category-list"> 64 65 66 @foreach (var item in parentGroup.Subgroups) 67 { 68 <a class="category-group-link" href="/Default.aspx?Id=@groupPageId&ParentGroup=@item.Id" title='@Translate("Link to category: ") @item.Name'> 69 70 <div class="category-list-item"> 71 72 @{ 73 string img = "/Files" + item.SmallImage; 74 } 75 <div class="category-list-item-img" style="background-image:url(@img)"></div> 76 77 <div class="category-list-item-info"> 78 79 <h3>@item.Name</h3> 80 </div> 81 </div> 82 </a> 83 } 84 85 86 </div> 87 </div>