LEVERANDØRER

Mouldshop repræsenterer førende producenter fra hele verden, det sikrer at vi altid tilbyder den bedste kvalitet til laveste pris. Vores mere end 75 år lange historie har givet os en indgående erfaring, med at udvælge de stærkeste leverandører og sikre højeste grad af leveringssikkerhed og kvalitet.

Vi er naturligvis også garant for at produkterne er fremstillet under forhold, som er forenelig med relevante retningslinjer og miljøkrav.

MOULDPRO

MRO produkter til plastmaskiner og udstyr.

Hos MOULDPRO specialiserer vi os i at levere kvalitetsprodukter og forbrugsvarer til den rigtige pris. Vores omfattende udvalg af produkter tæller bl.a. produkter til værktøjstemperering, termisk overvågning, formvedligeholdelsesspray, elektrovarme, granulat transport, plastiseringsudstyr, robotudstyr, formopspænding, normdele og specialværktøj og tilbehør som er omhyggeligt designet til at imødekomme de dynamiske behov hos støbeeksperter. Vores engagement rækker ud over blot at levere produkter; vi er dedikerede til at levere ekspertise i hvert eneste produkt, vi tilbyder.

Vi inviterer dig til at udforske vores katalog og er overbeviste om, at du vil finde de perfekte løsninger til dine behov. Din tilfredshed driver vores motivation til at forbedre og udmærke os hver dag. Velkommen til MOULDPRO, hvor kvalitet møder innovation i plastbranchen.

Flosense

Dit valg i termisk overvågning og optimering.

Hos Flosense specialiserer vi os i at forbedre effektiviteten og præcisionen i støbeprocessen. Vores fokus er på at udvikle innovative overvågningssystemer, der hjælper dig til at forstå den termiske proces når værktøjets temperatur har stor indflydelse på emnernes kvalitet og præcision.

Flosense hjælper med at forkorte cyklustiden, øge produktiviteten, forhindre spild, reducere energiforbruget, samt gøre formskift nemmere og hurtigere.

Stor fokus på delta-T og delta-P gør forståelsen om varmeoverførsel og tryktab nemmere og hjælper med at identificere fald grupper og skabe forbedringer.

Investér i Flosense og styrk din konkurrenceevne.

Error executing template "/Designs/Swift/Grid/Page/RowTemplates/6Columns.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_38d399a38d95488ea3cf6b8331ce44f4.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\hctswift.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Grid\Page\RowTemplates\6Columns.cshtml:line 177
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.GridRowViewModel> 2 @using Dynamicweb.Content.Items 3 4 @{ 5 string sectionClass = "py-3"; 6 string spaceBetweenRows = Model.Item.GetRawValueString("SpaceBetweenRows", "spacing"); 7 string spaceBetweenRowsMobile = Model.Item.GetRawValueString("SpaceBetweenRowsMobile", "auto"); 8 9 //Row spacing mobile auto 10 if (spaceBetweenRowsMobile == "auto") { 11 spaceBetweenRowsMobile = spaceBetweenRows; 12 } 13 14 //Row spacing mobile 15 switch (spaceBetweenRowsMobile) { 16 case "none": //No spacing 17 sectionClass = "py-0"; 18 break; 19 case "spacing": //Small spacing top and bottom 20 sectionClass = "py-3"; 21 break; 22 case "spacing-small-top": //Small spacing top 23 sectionClass = "pt-3"; 24 break; 25 case "spacing-small-bottom": //Small spacing bottom 26 sectionClass = "pb-3"; 27 break; 28 case "spacing-medium": //Medium spacing top and bottom 29 sectionClass = "py-4"; 30 break; 31 case "spacing-medium-top": //Medium spacing top 32 sectionClass = "pt-4"; 33 break; 34 case "spacing-medium-bottom": //Medium spacing bottom 35 sectionClass = "pb-4"; 36 break; 37 case "spacing-large": //Large spacing top and bottom 38 sectionClass = "py-5"; 39 break; 40 case "spacing-top": //Large spacing top 41 sectionClass = "pt-5"; 42 break; 43 case "spacing-bottom": //Large spacing bottom 44 sectionClass = "pb-5"; 45 break; 46 } 47 48 //Row spacing dekstop 49 switch (spaceBetweenRows) { 50 case "none": //No spacing 51 sectionClass += " py-lg-0"; 52 break; 53 case "spacing": //Small spacing top and bottom 54 sectionClass += " py-lg-3"; 55 break; 56 case "spacing-small-top": //Small spacing top 57 sectionClass += " pt-lg-3 pb-lg-0"; 58 break; 59 case "spacing-small-bottom": //Small spacing bottom 60 sectionClass += " pb-lg-3 pt-lg-0"; 61 break; 62 case "spacing-medium": //Medium spacing top and bottom 63 sectionClass += " py-lg-5"; 64 break; 65 case "spacing-medium-top": //Medium spacing top 66 sectionClass += " pt-lg-5 pb-lg-0"; 67 break; 68 case "spacing-medium-bottom": //Medium spacing bottom 69 sectionClass += " pb-lg-5 pt-lg-0"; 70 break; 71 case "spacing-large": //Large spacing top and bottom 72 sectionClass += " py-lg-6"; 73 break; 74 case "spacing-top": //Large spacing top 75 sectionClass += " pt-lg-6 pb-lg-0"; 76 break; 77 case "spacing-bottom": //Large spacing bottom 78 sectionClass += " pb-lg-6 pt-lg-0"; 79 break; 80 } 81 82 string width = Model.Item.GetRawValueString("Width", "").ToLower(); 83 string containerClass = "container-xl"; 84 if (width == "stretch") 85 { 86 containerClass = "container-fluid"; 87 } 88 if (width == "none") 89 { 90 containerClass = "container-fluid px-0"; 91 } 92 if (width == "compressed") 93 { 94 containerClass = " container-compressed"; 95 } 96 97 string rowClass = string.Empty; 98 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", string.Empty).ToLower(); 99 string spaceBetweenColumnsMobile = Model.Item.GetRawValueString("SpaceBetweenColumnsMobile", string.Empty).ToLower(); 100 //Mobile 101 if (spaceBetweenColumnsMobile == "auto") 102 { 103 spaceBetweenColumnsMobile = spaceBetweenColumns; 104 } 105 if (spaceBetweenColumnsMobile == "stick") { 106 rowClass = " gap-0"; 107 } 108 if (spaceBetweenColumnsMobile == "spacing-medium") 109 { 110 rowClass = " gap-4"; 111 } 112 if (spaceBetweenColumnsMobile == "spacing-large") { 113 rowClass = " gap-5"; 114 } 115 //Desktop 116 if (spaceBetweenColumns == "stick") { 117 rowClass += " gap-lg-0"; 118 } 119 if (spaceBetweenColumns == "spacing-medium") 120 { 121 rowClass += " gap-lg-4"; 122 } 123 if (spaceBetweenColumns == "spacing-large") { 124 rowClass += " gap-lg-5"; 125 } 126127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128129 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 130 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 131 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 132 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 133 string animationOnScrollCol3 = Model.Item.GetRawValueString("AnimationOnScrollCol3", "no-animation"); 134 animationOnScrollCol3 = animationOnScrollCol3 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol3 + "'" : ""; 135 string animationOnScrollCol4 = Model.Item.GetRawValueString("AnimationOnScrollCol4", "no-animation"); 136 animationOnScrollCol4 = animationOnScrollCol4 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol4 + "'" : ""; 137 string animationOnScrollCol5 = Model.Item.GetRawValueString("AnimationOnScrollCol5", "no-animation"); 138 animationOnScrollCol5 = animationOnScrollCol5 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol5 + "'" : ""; 139 string animationOnScrollCol6 = Model.Item.GetRawValueString("AnimationOnScrollCol6", "no-animation"); 140 animationOnScrollCol6 = animationOnScrollCol6 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol6 + "'" : ""; 141142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151152 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 153 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 154 backgroundImagePath = !string.IsNullOrEmpty(backgroundImagePath) ? $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=2600&format=webp&compression=75" : string.Empty; 155 backgroundImagePath = Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(backgroundImagePath); 156 string backgroundRepeat = Model.Item.GetRawValueString("BackgroundImageRepeat", "no-repeat"); 157 string backgroundImageSize = Model.Item.GetRawValueString("BackgroundImageSize", "initial"); 158 int xPos = backgroundImage?.FocalPositionFromLeft ?? 50; 159 int yPos = backgroundImage?.FocalPositionFromTop ?? 50; 160 string cssPosition = $"{xPos}% {yPos}%"; 161 string gradient = Model.Item.GetRawValueString("Gradient", string.Empty); 162 string gradientOpacity = Model.Item.GetRawValueString("GradientOpacity", "0.00"); 163 string gradientString = "linear-gradient(" + gradient + "deg," + "rgba(var(--swift-foreground-color-rgb)," + gradientOpacity + "), rgba(var(--swift-background-color-rgb)," + gradientOpacity + "))"; 164 string backgroundImageString = "url(" + backgroundImagePath + ")"; 165 string backgroundImagePositionString = "background-position:" + cssPosition + ";"; 166 string backgroundRepeatString = "background-repeat:" + backgroundRepeat + ";"; 167 string backgroundImageSizeString = "background-size:" + backgroundImageSize + ";"; 168 string styleString = string.Empty; 169170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173174 foreach (var itemId in decorations) 175 { 176 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 177 item.TryGetValue("Class", out object classes); 178 if (classes is null) 179 { 180 continue; 181 } 182183 var cssString = (string)classes; 184 if (cssString.StartsWith("[")) 185 { 186 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 187 cssClasses.AddRange(cssArray); 188 } 189 else 190 { 191 cssClasses.Add(cssString.Replace(",", " ")); 192 } 193 } 194 css = string.Join(" ", cssClasses).Trim(); 195196 @* Only gradient *@ 197198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202203 @* Only background image *@ 204205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209210 @* Gradient and background image *@ 211212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219220 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).Output()) || !string.IsNullOrWhiteSpace(Model.Column(3).Output()) || !string.IsNullOrWhiteSpace(Model.Column(4).Output()) || !string.IsNullOrWhiteSpace(Model.Column(5).Output()) || !string.IsNullOrWhiteSpace(Model.Column(6).Output())) 221 { 222 <div class="@(sectionClass)@(theme) @(css) item_@Model.Item.SystemName.ToLower()" @styleString data-swift-gridrow> 223 <div class="@containerClass@(hideOverflow)"> 224 <div class="grid grid-@(mobileColumnSize) grid-lg-@Model.Columns.Count()@(rowClass)"> 225 <div class="g-col @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol1 style="--bs-columns:12"> 226 @Model.Column(1).Output() 227 </div> 228 <div class="g-col @(Model.Column(2).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol2 style="--bs-columns:12"> 229 @Model.Column(2).Output() 230 </div> 231 <div class="g-col @(Model.Column(3).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol3 style="--bs-columns:12"> 232 @Model.Column(3).Output() 233 </div> 234 <div class="g-col @(Model.Column(4).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol4 style="--bs-columns:12"> 235 @Model.Column(4).Output() 236 </div> 237 <div class="g-col @(Model.Column(5).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol5 style="--bs-columns:12"> 238 @Model.Column(5).Output() 239 </div> 240 <div class="g-col @(Model.Column(6).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol6 style="--bs-columns:12"> 241 @Model.Column(6).Output() 242 </div> 243 </div> 244 </div> 245 </div> 246 } 247 } 248
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/6Columns.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_38d399a38d95488ea3cf6b8331ce44f4.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\hctswift.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Grid\Page\RowTemplates\6Columns.cshtml:line 177
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.GridRowViewModel> 2 @using Dynamicweb.Content.Items 3 4 @{ 5 string sectionClass = "py-3"; 6 string spaceBetweenRows = Model.Item.GetRawValueString("SpaceBetweenRows", "spacing"); 7 string spaceBetweenRowsMobile = Model.Item.GetRawValueString("SpaceBetweenRowsMobile", "auto"); 8 9 //Row spacing mobile auto 10 if (spaceBetweenRowsMobile == "auto") { 11 spaceBetweenRowsMobile = spaceBetweenRows; 12 } 13 14 //Row spacing mobile 15 switch (spaceBetweenRowsMobile) { 16 case "none": //No spacing 17 sectionClass = "py-0"; 18 break; 19 case "spacing": //Small spacing top and bottom 20 sectionClass = "py-3"; 21 break; 22 case "spacing-small-top": //Small spacing top 23 sectionClass = "pt-3"; 24 break; 25 case "spacing-small-bottom": //Small spacing bottom 26 sectionClass = "pb-3"; 27 break; 28 case "spacing-medium": //Medium spacing top and bottom 29 sectionClass = "py-4"; 30 break; 31 case "spacing-medium-top": //Medium spacing top 32 sectionClass = "pt-4"; 33 break; 34 case "spacing-medium-bottom": //Medium spacing bottom 35 sectionClass = "pb-4"; 36 break; 37 case "spacing-large": //Large spacing top and bottom 38 sectionClass = "py-5"; 39 break; 40 case "spacing-top": //Large spacing top 41 sectionClass = "pt-5"; 42 break; 43 case "spacing-bottom": //Large spacing bottom 44 sectionClass = "pb-5"; 45 break; 46 } 47 48 //Row spacing dekstop 49 switch (spaceBetweenRows) { 50 case "none": //No spacing 51 sectionClass += " py-lg-0"; 52 break; 53 case "spacing": //Small spacing top and bottom 54 sectionClass += " py-lg-3"; 55 break; 56 case "spacing-small-top": //Small spacing top 57 sectionClass += " pt-lg-3 pb-lg-0"; 58 break; 59 case "spacing-small-bottom": //Small spacing bottom 60 sectionClass += " pb-lg-3 pt-lg-0"; 61 break; 62 case "spacing-medium": //Medium spacing top and bottom 63 sectionClass += " py-lg-5"; 64 break; 65 case "spacing-medium-top": //Medium spacing top 66 sectionClass += " pt-lg-5 pb-lg-0"; 67 break; 68 case "spacing-medium-bottom": //Medium spacing bottom 69 sectionClass += " pb-lg-5 pt-lg-0"; 70 break; 71 case "spacing-large": //Large spacing top and bottom 72 sectionClass += " py-lg-6"; 73 break; 74 case "spacing-top": //Large spacing top 75 sectionClass += " pt-lg-6 pb-lg-0"; 76 break; 77 case "spacing-bottom": //Large spacing bottom 78 sectionClass += " pb-lg-6 pt-lg-0"; 79 break; 80 } 81 82 string width = Model.Item.GetRawValueString("Width", "").ToLower(); 83 string containerClass = "container-xl"; 84 if (width == "stretch") 85 { 86 containerClass = "container-fluid"; 87 } 88 if (width == "none") 89 { 90 containerClass = "container-fluid px-0"; 91 } 92 if (width == "compressed") 93 { 94 containerClass = " container-compressed"; 95 } 96 97 string rowClass = string.Empty; 98 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", string.Empty).ToLower(); 99 string spaceBetweenColumnsMobile = Model.Item.GetRawValueString("SpaceBetweenColumnsMobile", string.Empty).ToLower(); 100 //Mobile 101 if (spaceBetweenColumnsMobile == "auto") 102 { 103 spaceBetweenColumnsMobile = spaceBetweenColumns; 104 } 105 if (spaceBetweenColumnsMobile == "stick") { 106 rowClass = " gap-0"; 107 } 108 if (spaceBetweenColumnsMobile == "spacing-medium") 109 { 110 rowClass = " gap-4"; 111 } 112 if (spaceBetweenColumnsMobile == "spacing-large") { 113 rowClass = " gap-5"; 114 } 115 //Desktop 116 if (spaceBetweenColumns == "stick") { 117 rowClass += " gap-lg-0"; 118 } 119 if (spaceBetweenColumns == "spacing-medium") 120 { 121 rowClass += " gap-lg-4"; 122 } 123 if (spaceBetweenColumns == "spacing-large") { 124 rowClass += " gap-lg-5"; 125 } 126127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128129 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 130 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 131 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 132 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 133 string animationOnScrollCol3 = Model.Item.GetRawValueString("AnimationOnScrollCol3", "no-animation"); 134 animationOnScrollCol3 = animationOnScrollCol3 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol3 + "'" : ""; 135 string animationOnScrollCol4 = Model.Item.GetRawValueString("AnimationOnScrollCol4", "no-animation"); 136 animationOnScrollCol4 = animationOnScrollCol4 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol4 + "'" : ""; 137 string animationOnScrollCol5 = Model.Item.GetRawValueString("AnimationOnScrollCol5", "no-animation"); 138 animationOnScrollCol5 = animationOnScrollCol5 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol5 + "'" : ""; 139 string animationOnScrollCol6 = Model.Item.GetRawValueString("AnimationOnScrollCol6", "no-animation"); 140 animationOnScrollCol6 = animationOnScrollCol6 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol6 + "'" : ""; 141142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151152 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 153 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 154 backgroundImagePath = !string.IsNullOrEmpty(backgroundImagePath) ? $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=2600&format=webp&compression=75" : string.Empty; 155 backgroundImagePath = Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(backgroundImagePath); 156 string backgroundRepeat = Model.Item.GetRawValueString("BackgroundImageRepeat", "no-repeat"); 157 string backgroundImageSize = Model.Item.GetRawValueString("BackgroundImageSize", "initial"); 158 int xPos = backgroundImage?.FocalPositionFromLeft ?? 50; 159 int yPos = backgroundImage?.FocalPositionFromTop ?? 50; 160 string cssPosition = $"{xPos}% {yPos}%"; 161 string gradient = Model.Item.GetRawValueString("Gradient", string.Empty); 162 string gradientOpacity = Model.Item.GetRawValueString("GradientOpacity", "0.00"); 163 string gradientString = "linear-gradient(" + gradient + "deg," + "rgba(var(--swift-foreground-color-rgb)," + gradientOpacity + "), rgba(var(--swift-background-color-rgb)," + gradientOpacity + "))"; 164 string backgroundImageString = "url(" + backgroundImagePath + ")"; 165 string backgroundImagePositionString = "background-position:" + cssPosition + ";"; 166 string backgroundRepeatString = "background-repeat:" + backgroundRepeat + ";"; 167 string backgroundImageSizeString = "background-size:" + backgroundImageSize + ";"; 168 string styleString = string.Empty; 169170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173174 foreach (var itemId in decorations) 175 { 176 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 177 item.TryGetValue("Class", out object classes); 178 if (classes is null) 179 { 180 continue; 181 } 182183 var cssString = (string)classes; 184 if (cssString.StartsWith("[")) 185 { 186 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 187 cssClasses.AddRange(cssArray); 188 } 189 else 190 { 191 cssClasses.Add(cssString.Replace(",", " ")); 192 } 193 } 194 css = string.Join(" ", cssClasses).Trim(); 195196 @* Only gradient *@ 197198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202203 @* Only background image *@ 204205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209210 @* Gradient and background image *@ 211212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219220 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).Output()) || !string.IsNullOrWhiteSpace(Model.Column(3).Output()) || !string.IsNullOrWhiteSpace(Model.Column(4).Output()) || !string.IsNullOrWhiteSpace(Model.Column(5).Output()) || !string.IsNullOrWhiteSpace(Model.Column(6).Output())) 221 { 222 <div class="@(sectionClass)@(theme) @(css) item_@Model.Item.SystemName.ToLower()" @styleString data-swift-gridrow> 223 <div class="@containerClass@(hideOverflow)"> 224 <div class="grid grid-@(mobileColumnSize) grid-lg-@Model.Columns.Count()@(rowClass)"> 225 <div class="g-col @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol1 style="--bs-columns:12"> 226 @Model.Column(1).Output() 227 </div> 228 <div class="g-col @(Model.Column(2).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol2 style="--bs-columns:12"> 229 @Model.Column(2).Output() 230 </div> 231 <div class="g-col @(Model.Column(3).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol3 style="--bs-columns:12"> 232 @Model.Column(3).Output() 233 </div> 234 <div class="g-col @(Model.Column(4).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol4 style="--bs-columns:12"> 235 @Model.Column(4).Output() 236 </div> 237 <div class="g-col @(Model.Column(5).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol5 style="--bs-columns:12"> 238 @Model.Column(5).Output() 239 </div> 240 <div class="g-col @(Model.Column(6).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol6 style="--bs-columns:12"> 241 @Model.Column(6).Output() 242 </div> 243 </div> 244 </div> 245 </div> 246 } 247 } 248
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/6Columns.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_38d399a38d95488ea3cf6b8331ce44f4.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\hctswift.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Grid\Page\RowTemplates\6Columns.cshtml:line 177
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.GridRowViewModel> 2 @using Dynamicweb.Content.Items 3 4 @{ 5 string sectionClass = "py-3"; 6 string spaceBetweenRows = Model.Item.GetRawValueString("SpaceBetweenRows", "spacing"); 7 string spaceBetweenRowsMobile = Model.Item.GetRawValueString("SpaceBetweenRowsMobile", "auto"); 8 9 //Row spacing mobile auto 10 if (spaceBetweenRowsMobile == "auto") { 11 spaceBetweenRowsMobile = spaceBetweenRows; 12 } 13 14 //Row spacing mobile 15 switch (spaceBetweenRowsMobile) { 16 case "none": //No spacing 17 sectionClass = "py-0"; 18 break; 19 case "spacing": //Small spacing top and bottom 20 sectionClass = "py-3"; 21 break; 22 case "spacing-small-top": //Small spacing top 23 sectionClass = "pt-3"; 24 break; 25 case "spacing-small-bottom": //Small spacing bottom 26 sectionClass = "pb-3"; 27 break; 28 case "spacing-medium": //Medium spacing top and bottom 29 sectionClass = "py-4"; 30 break; 31 case "spacing-medium-top": //Medium spacing top 32 sectionClass = "pt-4"; 33 break; 34 case "spacing-medium-bottom": //Medium spacing bottom 35 sectionClass = "pb-4"; 36 break; 37 case "spacing-large": //Large spacing top and bottom 38 sectionClass = "py-5"; 39 break; 40 case "spacing-top": //Large spacing top 41 sectionClass = "pt-5"; 42 break; 43 case "spacing-bottom": //Large spacing bottom 44 sectionClass = "pb-5"; 45 break; 46 } 47 48 //Row spacing dekstop 49 switch (spaceBetweenRows) { 50 case "none": //No spacing 51 sectionClass += " py-lg-0"; 52 break; 53 case "spacing": //Small spacing top and bottom 54 sectionClass += " py-lg-3"; 55 break; 56 case "spacing-small-top": //Small spacing top 57 sectionClass += " pt-lg-3 pb-lg-0"; 58 break; 59 case "spacing-small-bottom": //Small spacing bottom 60 sectionClass += " pb-lg-3 pt-lg-0"; 61 break; 62 case "spacing-medium": //Medium spacing top and bottom 63 sectionClass += " py-lg-5"; 64 break; 65 case "spacing-medium-top": //Medium spacing top 66 sectionClass += " pt-lg-5 pb-lg-0"; 67 break; 68 case "spacing-medium-bottom": //Medium spacing bottom 69 sectionClass += " pb-lg-5 pt-lg-0"; 70 break; 71 case "spacing-large": //Large spacing top and bottom 72 sectionClass += " py-lg-6"; 73 break; 74 case "spacing-top": //Large spacing top 75 sectionClass += " pt-lg-6 pb-lg-0"; 76 break; 77 case "spacing-bottom": //Large spacing bottom 78 sectionClass += " pb-lg-6 pt-lg-0"; 79 break; 80 } 81 82 string width = Model.Item.GetRawValueString("Width", "").ToLower(); 83 string containerClass = "container-xl"; 84 if (width == "stretch") 85 { 86 containerClass = "container-fluid"; 87 } 88 if (width == "none") 89 { 90 containerClass = "container-fluid px-0"; 91 } 92 if (width == "compressed") 93 { 94 containerClass = " container-compressed"; 95 } 96 97 string rowClass = string.Empty; 98 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", string.Empty).ToLower(); 99 string spaceBetweenColumnsMobile = Model.Item.GetRawValueString("SpaceBetweenColumnsMobile", string.Empty).ToLower(); 100 //Mobile 101 if (spaceBetweenColumnsMobile == "auto") 102 { 103 spaceBetweenColumnsMobile = spaceBetweenColumns; 104 } 105 if (spaceBetweenColumnsMobile == "stick") { 106 rowClass = " gap-0"; 107 } 108 if (spaceBetweenColumnsMobile == "spacing-medium") 109 { 110 rowClass = " gap-4"; 111 } 112 if (spaceBetweenColumnsMobile == "spacing-large") { 113 rowClass = " gap-5"; 114 } 115 //Desktop 116 if (spaceBetweenColumns == "stick") { 117 rowClass += " gap-lg-0"; 118 } 119 if (spaceBetweenColumns == "spacing-medium") 120 { 121 rowClass += " gap-lg-4"; 122 } 123 if (spaceBetweenColumns == "spacing-large") { 124 rowClass += " gap-lg-5"; 125 } 126127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128129 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 130 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 131 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 132 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 133 string animationOnScrollCol3 = Model.Item.GetRawValueString("AnimationOnScrollCol3", "no-animation"); 134 animationOnScrollCol3 = animationOnScrollCol3 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol3 + "'" : ""; 135 string animationOnScrollCol4 = Model.Item.GetRawValueString("AnimationOnScrollCol4", "no-animation"); 136 animationOnScrollCol4 = animationOnScrollCol4 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol4 + "'" : ""; 137 string animationOnScrollCol5 = Model.Item.GetRawValueString("AnimationOnScrollCol5", "no-animation"); 138 animationOnScrollCol5 = animationOnScrollCol5 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol5 + "'" : ""; 139 string animationOnScrollCol6 = Model.Item.GetRawValueString("AnimationOnScrollCol6", "no-animation"); 140 animationOnScrollCol6 = animationOnScrollCol6 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol6 + "'" : ""; 141142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151152 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 153 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 154 backgroundImagePath = !string.IsNullOrEmpty(backgroundImagePath) ? $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=2600&format=webp&compression=75" : string.Empty; 155 backgroundImagePath = Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(backgroundImagePath); 156 string backgroundRepeat = Model.Item.GetRawValueString("BackgroundImageRepeat", "no-repeat"); 157 string backgroundImageSize = Model.Item.GetRawValueString("BackgroundImageSize", "initial"); 158 int xPos = backgroundImage?.FocalPositionFromLeft ?? 50; 159 int yPos = backgroundImage?.FocalPositionFromTop ?? 50; 160 string cssPosition = $"{xPos}% {yPos}%"; 161 string gradient = Model.Item.GetRawValueString("Gradient", string.Empty); 162 string gradientOpacity = Model.Item.GetRawValueString("GradientOpacity", "0.00"); 163 string gradientString = "linear-gradient(" + gradient + "deg," + "rgba(var(--swift-foreground-color-rgb)," + gradientOpacity + "), rgba(var(--swift-background-color-rgb)," + gradientOpacity + "))"; 164 string backgroundImageString = "url(" + backgroundImagePath + ")"; 165 string backgroundImagePositionString = "background-position:" + cssPosition + ";"; 166 string backgroundRepeatString = "background-repeat:" + backgroundRepeat + ";"; 167 string backgroundImageSizeString = "background-size:" + backgroundImageSize + ";"; 168 string styleString = string.Empty; 169170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173174 foreach (var itemId in decorations) 175 { 176 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 177 item.TryGetValue("Class", out object classes); 178 if (classes is null) 179 { 180 continue; 181 } 182183 var cssString = (string)classes; 184 if (cssString.StartsWith("[")) 185 { 186 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 187 cssClasses.AddRange(cssArray); 188 } 189 else 190 { 191 cssClasses.Add(cssString.Replace(",", " ")); 192 } 193 } 194 css = string.Join(" ", cssClasses).Trim(); 195196 @* Only gradient *@ 197198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202203 @* Only background image *@ 204205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209210 @* Gradient and background image *@ 211212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219220 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).Output()) || !string.IsNullOrWhiteSpace(Model.Column(3).Output()) || !string.IsNullOrWhiteSpace(Model.Column(4).Output()) || !string.IsNullOrWhiteSpace(Model.Column(5).Output()) || !string.IsNullOrWhiteSpace(Model.Column(6).Output())) 221 { 222 <div class="@(sectionClass)@(theme) @(css) item_@Model.Item.SystemName.ToLower()" @styleString data-swift-gridrow> 223 <div class="@containerClass@(hideOverflow)"> 224 <div class="grid grid-@(mobileColumnSize) grid-lg-@Model.Columns.Count()@(rowClass)"> 225 <div class="g-col @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol1 style="--bs-columns:12"> 226 @Model.Column(1).Output() 227 </div> 228 <div class="g-col @(Model.Column(2).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol2 style="--bs-columns:12"> 229 @Model.Column(2).Output() 230 </div> 231 <div class="g-col @(Model.Column(3).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol3 style="--bs-columns:12"> 232 @Model.Column(3).Output() 233 </div> 234 <div class="g-col @(Model.Column(4).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol4 style="--bs-columns:12"> 235 @Model.Column(4).Output() 236 </div> 237 <div class="g-col @(Model.Column(5).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol5 style="--bs-columns:12"> 238 @Model.Column(5).Output() 239 </div> 240 <div class="g-col @(Model.Column(6).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol6 style="--bs-columns:12"> 241 @Model.Column(6).Output() 242 </div> 243 </div> 244 </div> 245 </div> 246 } 247 } 248
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/6Columns.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_38d399a38d95488ea3cf6b8331ce44f4.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\hctswift.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Grid\Page\RowTemplates\6Columns.cshtml:line 177
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.GridRowViewModel> 2 @using Dynamicweb.Content.Items 3 4 @{ 5 string sectionClass = "py-3"; 6 string spaceBetweenRows = Model.Item.GetRawValueString("SpaceBetweenRows", "spacing"); 7 string spaceBetweenRowsMobile = Model.Item.GetRawValueString("SpaceBetweenRowsMobile", "auto"); 8 9 //Row spacing mobile auto 10 if (spaceBetweenRowsMobile == "auto") { 11 spaceBetweenRowsMobile = spaceBetweenRows; 12 } 13 14 //Row spacing mobile 15 switch (spaceBetweenRowsMobile) { 16 case "none": //No spacing 17 sectionClass = "py-0"; 18 break; 19 case "spacing": //Small spacing top and bottom 20 sectionClass = "py-3"; 21 break; 22 case "spacing-small-top": //Small spacing top 23 sectionClass = "pt-3"; 24 break; 25 case "spacing-small-bottom": //Small spacing bottom 26 sectionClass = "pb-3"; 27 break; 28 case "spacing-medium": //Medium spacing top and bottom 29 sectionClass = "py-4"; 30 break; 31 case "spacing-medium-top": //Medium spacing top 32 sectionClass = "pt-4"; 33 break; 34 case "spacing-medium-bottom": //Medium spacing bottom 35 sectionClass = "pb-4"; 36 break; 37 case "spacing-large": //Large spacing top and bottom 38 sectionClass = "py-5"; 39 break; 40 case "spacing-top": //Large spacing top 41 sectionClass = "pt-5"; 42 break; 43 case "spacing-bottom": //Large spacing bottom 44 sectionClass = "pb-5"; 45 break; 46 } 47 48 //Row spacing dekstop 49 switch (spaceBetweenRows) { 50 case "none": //No spacing 51 sectionClass += " py-lg-0"; 52 break; 53 case "spacing": //Small spacing top and bottom 54 sectionClass += " py-lg-3"; 55 break; 56 case "spacing-small-top": //Small spacing top 57 sectionClass += " pt-lg-3 pb-lg-0"; 58 break; 59 case "spacing-small-bottom": //Small spacing bottom 60 sectionClass += " pb-lg-3 pt-lg-0"; 61 break; 62 case "spacing-medium": //Medium spacing top and bottom 63 sectionClass += " py-lg-5"; 64 break; 65 case "spacing-medium-top": //Medium spacing top 66 sectionClass += " pt-lg-5 pb-lg-0"; 67 break; 68 case "spacing-medium-bottom": //Medium spacing bottom 69 sectionClass += " pb-lg-5 pt-lg-0"; 70 break; 71 case "spacing-large": //Large spacing top and bottom 72 sectionClass += " py-lg-6"; 73 break; 74 case "spacing-top": //Large spacing top 75 sectionClass += " pt-lg-6 pb-lg-0"; 76 break; 77 case "spacing-bottom": //Large spacing bottom 78 sectionClass += " pb-lg-6 pt-lg-0"; 79 break; 80 } 81 82 string width = Model.Item.GetRawValueString("Width", "").ToLower(); 83 string containerClass = "container-xl"; 84 if (width == "stretch") 85 { 86 containerClass = "container-fluid"; 87 } 88 if (width == "none") 89 { 90 containerClass = "container-fluid px-0"; 91 } 92 if (width == "compressed") 93 { 94 containerClass = " container-compressed"; 95 } 96 97 string rowClass = string.Empty; 98 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", string.Empty).ToLower(); 99 string spaceBetweenColumnsMobile = Model.Item.GetRawValueString("SpaceBetweenColumnsMobile", string.Empty).ToLower(); 100 //Mobile 101 if (spaceBetweenColumnsMobile == "auto") 102 { 103 spaceBetweenColumnsMobile = spaceBetweenColumns; 104 } 105 if (spaceBetweenColumnsMobile == "stick") { 106 rowClass = " gap-0"; 107 } 108 if (spaceBetweenColumnsMobile == "spacing-medium") 109 { 110 rowClass = " gap-4"; 111 } 112 if (spaceBetweenColumnsMobile == "spacing-large") { 113 rowClass = " gap-5"; 114 } 115 //Desktop 116 if (spaceBetweenColumns == "stick") { 117 rowClass += " gap-lg-0"; 118 } 119 if (spaceBetweenColumns == "spacing-medium") 120 { 121 rowClass += " gap-lg-4"; 122 } 123 if (spaceBetweenColumns == "spacing-large") { 124 rowClass += " gap-lg-5"; 125 } 126127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128129 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 130 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 131 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 132 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 133 string animationOnScrollCol3 = Model.Item.GetRawValueString("AnimationOnScrollCol3", "no-animation"); 134 animationOnScrollCol3 = animationOnScrollCol3 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol3 + "'" : ""; 135 string animationOnScrollCol4 = Model.Item.GetRawValueString("AnimationOnScrollCol4", "no-animation"); 136 animationOnScrollCol4 = animationOnScrollCol4 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol4 + "'" : ""; 137 string animationOnScrollCol5 = Model.Item.GetRawValueString("AnimationOnScrollCol5", "no-animation"); 138 animationOnScrollCol5 = animationOnScrollCol5 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol5 + "'" : ""; 139 string animationOnScrollCol6 = Model.Item.GetRawValueString("AnimationOnScrollCol6", "no-animation"); 140 animationOnScrollCol6 = animationOnScrollCol6 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol6 + "'" : ""; 141142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151152 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 153 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 154 backgroundImagePath = !string.IsNullOrEmpty(backgroundImagePath) ? $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=2600&format=webp&compression=75" : string.Empty; 155 backgroundImagePath = Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(backgroundImagePath); 156 string backgroundRepeat = Model.Item.GetRawValueString("BackgroundImageRepeat", "no-repeat"); 157 string backgroundImageSize = Model.Item.GetRawValueString("BackgroundImageSize", "initial"); 158 int xPos = backgroundImage?.FocalPositionFromLeft ?? 50; 159 int yPos = backgroundImage?.FocalPositionFromTop ?? 50; 160 string cssPosition = $"{xPos}% {yPos}%"; 161 string gradient = Model.Item.GetRawValueString("Gradient", string.Empty); 162 string gradientOpacity = Model.Item.GetRawValueString("GradientOpacity", "0.00"); 163 string gradientString = "linear-gradient(" + gradient + "deg," + "rgba(var(--swift-foreground-color-rgb)," + gradientOpacity + "), rgba(var(--swift-background-color-rgb)," + gradientOpacity + "))"; 164 string backgroundImageString = "url(" + backgroundImagePath + ")"; 165 string backgroundImagePositionString = "background-position:" + cssPosition + ";"; 166 string backgroundRepeatString = "background-repeat:" + backgroundRepeat + ";"; 167 string backgroundImageSizeString = "background-size:" + backgroundImageSize + ";"; 168 string styleString = string.Empty; 169170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173174 foreach (var itemId in decorations) 175 { 176 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 177 item.TryGetValue("Class", out object classes); 178 if (classes is null) 179 { 180 continue; 181 } 182183 var cssString = (string)classes; 184 if (cssString.StartsWith("[")) 185 { 186 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 187 cssClasses.AddRange(cssArray); 188 } 189 else 190 { 191 cssClasses.Add(cssString.Replace(",", " ")); 192 } 193 } 194 css = string.Join(" ", cssClasses).Trim(); 195196 @* Only gradient *@ 197198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202203 @* Only background image *@ 204205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209210 @* Gradient and background image *@ 211212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219220 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).Output()) || !string.IsNullOrWhiteSpace(Model.Column(3).Output()) || !string.IsNullOrWhiteSpace(Model.Column(4).Output()) || !string.IsNullOrWhiteSpace(Model.Column(5).Output()) || !string.IsNullOrWhiteSpace(Model.Column(6).Output())) 221 { 222 <div class="@(sectionClass)@(theme) @(css) item_@Model.Item.SystemName.ToLower()" @styleString data-swift-gridrow> 223 <div class="@containerClass@(hideOverflow)"> 224 <div class="grid grid-@(mobileColumnSize) grid-lg-@Model.Columns.Count()@(rowClass)"> 225 <div class="g-col @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol1 style="--bs-columns:12"> 226 @Model.Column(1).Output() 227 </div> 228 <div class="g-col @(Model.Column(2).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol2 style="--bs-columns:12"> 229 @Model.Column(2).Output() 230 </div> 231 <div class="g-col @(Model.Column(3).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol3 style="--bs-columns:12"> 232 @Model.Column(3).Output() 233 </div> 234 <div class="g-col @(Model.Column(4).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol4 style="--bs-columns:12"> 235 @Model.Column(4).Output() 236 </div> 237 <div class="g-col @(Model.Column(5).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol5 style="--bs-columns:12"> 238 @Model.Column(5).Output() 239 </div> 240 <div class="g-col @(Model.Column(6).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol6 style="--bs-columns:12"> 241 @Model.Column(6).Output() 242 </div> 243 </div> 244 </div> 245 </div> 246 } 247 } 248
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/6Columns.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_38d399a38d95488ea3cf6b8331ce44f4.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\hctswift.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Grid\Page\RowTemplates\6Columns.cshtml:line 177
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.GridRowViewModel> 2 @using Dynamicweb.Content.Items 3 4 @{ 5 string sectionClass = "py-3"; 6 string spaceBetweenRows = Model.Item.GetRawValueString("SpaceBetweenRows", "spacing"); 7 string spaceBetweenRowsMobile = Model.Item.GetRawValueString("SpaceBetweenRowsMobile", "auto"); 8 9 //Row spacing mobile auto 10 if (spaceBetweenRowsMobile == "auto") { 11 spaceBetweenRowsMobile = spaceBetweenRows; 12 } 13 14 //Row spacing mobile 15 switch (spaceBetweenRowsMobile) { 16 case "none": //No spacing 17 sectionClass = "py-0"; 18 break; 19 case "spacing": //Small spacing top and bottom 20 sectionClass = "py-3"; 21 break; 22 case "spacing-small-top": //Small spacing top 23 sectionClass = "pt-3"; 24 break; 25 case "spacing-small-bottom": //Small spacing bottom 26 sectionClass = "pb-3"; 27 break; 28 case "spacing-medium": //Medium spacing top and bottom 29 sectionClass = "py-4"; 30 break; 31 case "spacing-medium-top": //Medium spacing top 32 sectionClass = "pt-4"; 33 break; 34 case "spacing-medium-bottom": //Medium spacing bottom 35 sectionClass = "pb-4"; 36 break; 37 case "spacing-large": //Large spacing top and bottom 38 sectionClass = "py-5"; 39 break; 40 case "spacing-top": //Large spacing top 41 sectionClass = "pt-5"; 42 break; 43 case "spacing-bottom": //Large spacing bottom 44 sectionClass = "pb-5"; 45 break; 46 } 47 48 //Row spacing dekstop 49 switch (spaceBetweenRows) { 50 case "none": //No spacing 51 sectionClass += " py-lg-0"; 52 break; 53 case "spacing": //Small spacing top and bottom 54 sectionClass += " py-lg-3"; 55 break; 56 case "spacing-small-top": //Small spacing top 57 sectionClass += " pt-lg-3 pb-lg-0"; 58 break; 59 case "spacing-small-bottom": //Small spacing bottom 60 sectionClass += " pb-lg-3 pt-lg-0"; 61 break; 62 case "spacing-medium": //Medium spacing top and bottom 63 sectionClass += " py-lg-5"; 64 break; 65 case "spacing-medium-top": //Medium spacing top 66 sectionClass += " pt-lg-5 pb-lg-0"; 67 break; 68 case "spacing-medium-bottom": //Medium spacing bottom 69 sectionClass += " pb-lg-5 pt-lg-0"; 70 break; 71 case "spacing-large": //Large spacing top and bottom 72 sectionClass += " py-lg-6"; 73 break; 74 case "spacing-top": //Large spacing top 75 sectionClass += " pt-lg-6 pb-lg-0"; 76 break; 77 case "spacing-bottom": //Large spacing bottom 78 sectionClass += " pb-lg-6 pt-lg-0"; 79 break; 80 } 81 82 string width = Model.Item.GetRawValueString("Width", "").ToLower(); 83 string containerClass = "container-xl"; 84 if (width == "stretch") 85 { 86 containerClass = "container-fluid"; 87 } 88 if (width == "none") 89 { 90 containerClass = "container-fluid px-0"; 91 } 92 if (width == "compressed") 93 { 94 containerClass = " container-compressed"; 95 } 96 97 string rowClass = string.Empty; 98 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", string.Empty).ToLower(); 99 string spaceBetweenColumnsMobile = Model.Item.GetRawValueString("SpaceBetweenColumnsMobile", string.Empty).ToLower(); 100 //Mobile 101 if (spaceBetweenColumnsMobile == "auto") 102 { 103 spaceBetweenColumnsMobile = spaceBetweenColumns; 104 } 105 if (spaceBetweenColumnsMobile == "stick") { 106 rowClass = " gap-0"; 107 } 108 if (spaceBetweenColumnsMobile == "spacing-medium") 109 { 110 rowClass = " gap-4"; 111 } 112 if (spaceBetweenColumnsMobile == "spacing-large") { 113 rowClass = " gap-5"; 114 } 115 //Desktop 116 if (spaceBetweenColumns == "stick") { 117 rowClass += " gap-lg-0"; 118 } 119 if (spaceBetweenColumns == "spacing-medium") 120 { 121 rowClass += " gap-lg-4"; 122 } 123 if (spaceBetweenColumns == "spacing-large") { 124 rowClass += " gap-lg-5"; 125 } 126127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128129 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 130 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 131 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 132 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 133 string animationOnScrollCol3 = Model.Item.GetRawValueString("AnimationOnScrollCol3", "no-animation"); 134 animationOnScrollCol3 = animationOnScrollCol3 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol3 + "'" : ""; 135 string animationOnScrollCol4 = Model.Item.GetRawValueString("AnimationOnScrollCol4", "no-animation"); 136 animationOnScrollCol4 = animationOnScrollCol4 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol4 + "'" : ""; 137 string animationOnScrollCol5 = Model.Item.GetRawValueString("AnimationOnScrollCol5", "no-animation"); 138 animationOnScrollCol5 = animationOnScrollCol5 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol5 + "'" : ""; 139 string animationOnScrollCol6 = Model.Item.GetRawValueString("AnimationOnScrollCol6", "no-animation"); 140 animationOnScrollCol6 = animationOnScrollCol6 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol6 + "'" : ""; 141142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151152 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 153 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 154 backgroundImagePath = !string.IsNullOrEmpty(backgroundImagePath) ? $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=2600&format=webp&compression=75" : string.Empty; 155 backgroundImagePath = Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(backgroundImagePath); 156 string backgroundRepeat = Model.Item.GetRawValueString("BackgroundImageRepeat", "no-repeat"); 157 string backgroundImageSize = Model.Item.GetRawValueString("BackgroundImageSize", "initial"); 158 int xPos = backgroundImage?.FocalPositionFromLeft ?? 50; 159 int yPos = backgroundImage?.FocalPositionFromTop ?? 50; 160 string cssPosition = $"{xPos}% {yPos}%"; 161 string gradient = Model.Item.GetRawValueString("Gradient", string.Empty); 162 string gradientOpacity = Model.Item.GetRawValueString("GradientOpacity", "0.00"); 163 string gradientString = "linear-gradient(" + gradient + "deg," + "rgba(var(--swift-foreground-color-rgb)," + gradientOpacity + "), rgba(var(--swift-background-color-rgb)," + gradientOpacity + "))"; 164 string backgroundImageString = "url(" + backgroundImagePath + ")"; 165 string backgroundImagePositionString = "background-position:" + cssPosition + ";"; 166 string backgroundRepeatString = "background-repeat:" + backgroundRepeat + ";"; 167 string backgroundImageSizeString = "background-size:" + backgroundImageSize + ";"; 168 string styleString = string.Empty; 169170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173174 foreach (var itemId in decorations) 175 { 176 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 177 item.TryGetValue("Class", out object classes); 178 if (classes is null) 179 { 180 continue; 181 } 182183 var cssString = (string)classes; 184 if (cssString.StartsWith("[")) 185 { 186 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 187 cssClasses.AddRange(cssArray); 188 } 189 else 190 { 191 cssClasses.Add(cssString.Replace(",", " ")); 192 } 193 } 194 css = string.Join(" ", cssClasses).Trim(); 195196 @* Only gradient *@ 197198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202203 @* Only background image *@ 204205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209210 @* Gradient and background image *@ 211212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219220 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).Output()) || !string.IsNullOrWhiteSpace(Model.Column(3).Output()) || !string.IsNullOrWhiteSpace(Model.Column(4).Output()) || !string.IsNullOrWhiteSpace(Model.Column(5).Output()) || !string.IsNullOrWhiteSpace(Model.Column(6).Output())) 221 { 222 <div class="@(sectionClass)@(theme) @(css) item_@Model.Item.SystemName.ToLower()" @styleString data-swift-gridrow> 223 <div class="@containerClass@(hideOverflow)"> 224 <div class="grid grid-@(mobileColumnSize) grid-lg-@Model.Columns.Count()@(rowClass)"> 225 <div class="g-col @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol1 style="--bs-columns:12"> 226 @Model.Column(1).Output() 227 </div> 228 <div class="g-col @(Model.Column(2).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol2 style="--bs-columns:12"> 229 @Model.Column(2).Output() 230 </div> 231 <div class="g-col @(Model.Column(3).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol3 style="--bs-columns:12"> 232 @Model.Column(3).Output() 233 </div> 234 <div class="g-col @(Model.Column(4).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol4 style="--bs-columns:12"> 235 @Model.Column(4).Output() 236 </div> 237 <div class="g-col @(Model.Column(5).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol5 style="--bs-columns:12"> 238 @Model.Column(5).Output() 239 </div> 240 <div class="g-col @(Model.Column(6).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol6 style="--bs-columns:12"> 241 @Model.Column(6).Output() 242 </div> 243 </div> 244 </div> 245 </div> 246 } 247 } 248
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/6Columns.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_38d399a38d95488ea3cf6b8331ce44f4.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\hctswift.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Grid\Page\RowTemplates\6Columns.cshtml:line 177
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.GridRowViewModel> 2 @using Dynamicweb.Content.Items 3 4 @{ 5 string sectionClass = "py-3"; 6 string spaceBetweenRows = Model.Item.GetRawValueString("SpaceBetweenRows", "spacing"); 7 string spaceBetweenRowsMobile = Model.Item.GetRawValueString("SpaceBetweenRowsMobile", "auto"); 8 9 //Row spacing mobile auto 10 if (spaceBetweenRowsMobile == "auto") { 11 spaceBetweenRowsMobile = spaceBetweenRows; 12 } 13 14 //Row spacing mobile 15 switch (spaceBetweenRowsMobile) { 16 case "none": //No spacing 17 sectionClass = "py-0"; 18 break; 19 case "spacing": //Small spacing top and bottom 20 sectionClass = "py-3"; 21 break; 22 case "spacing-small-top": //Small spacing top 23 sectionClass = "pt-3"; 24 break; 25 case "spacing-small-bottom": //Small spacing bottom 26 sectionClass = "pb-3"; 27 break; 28 case "spacing-medium": //Medium spacing top and bottom 29 sectionClass = "py-4"; 30 break; 31 case "spacing-medium-top": //Medium spacing top 32 sectionClass = "pt-4"; 33 break; 34 case "spacing-medium-bottom": //Medium spacing bottom 35 sectionClass = "pb-4"; 36 break; 37 case "spacing-large": //Large spacing top and bottom 38 sectionClass = "py-5"; 39 break; 40 case "spacing-top": //Large spacing top 41 sectionClass = "pt-5"; 42 break; 43 case "spacing-bottom": //Large spacing bottom 44 sectionClass = "pb-5"; 45 break; 46 } 47 48 //Row spacing dekstop 49 switch (spaceBetweenRows) { 50 case "none": //No spacing 51 sectionClass += " py-lg-0"; 52 break; 53 case "spacing": //Small spacing top and bottom 54 sectionClass += " py-lg-3"; 55 break; 56 case "spacing-small-top": //Small spacing top 57 sectionClass += " pt-lg-3 pb-lg-0"; 58 break; 59 case "spacing-small-bottom": //Small spacing bottom 60 sectionClass += " pb-lg-3 pt-lg-0"; 61 break; 62 case "spacing-medium": //Medium spacing top and bottom 63 sectionClass += " py-lg-5"; 64 break; 65 case "spacing-medium-top": //Medium spacing top 66 sectionClass += " pt-lg-5 pb-lg-0"; 67 break; 68 case "spacing-medium-bottom": //Medium spacing bottom 69 sectionClass += " pb-lg-5 pt-lg-0"; 70 break; 71 case "spacing-large": //Large spacing top and bottom 72 sectionClass += " py-lg-6"; 73 break; 74 case "spacing-top": //Large spacing top 75 sectionClass += " pt-lg-6 pb-lg-0"; 76 break; 77 case "spacing-bottom": //Large spacing bottom 78 sectionClass += " pb-lg-6 pt-lg-0"; 79 break; 80 } 81 82 string width = Model.Item.GetRawValueString("Width", "").ToLower(); 83 string containerClass = "container-xl"; 84 if (width == "stretch") 85 { 86 containerClass = "container-fluid"; 87 } 88 if (width == "none") 89 { 90 containerClass = "container-fluid px-0"; 91 } 92 if (width == "compressed") 93 { 94 containerClass = " container-compressed"; 95 } 96 97 string rowClass = string.Empty; 98 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", string.Empty).ToLower(); 99 string spaceBetweenColumnsMobile = Model.Item.GetRawValueString("SpaceBetweenColumnsMobile", string.Empty).ToLower(); 100 //Mobile 101 if (spaceBetweenColumnsMobile == "auto") 102 { 103 spaceBetweenColumnsMobile = spaceBetweenColumns; 104 } 105 if (spaceBetweenColumnsMobile == "stick") { 106 rowClass = " gap-0"; 107 } 108 if (spaceBetweenColumnsMobile == "spacing-medium") 109 { 110 rowClass = " gap-4"; 111 } 112 if (spaceBetweenColumnsMobile == "spacing-large") { 113 rowClass = " gap-5"; 114 } 115 //Desktop 116 if (spaceBetweenColumns == "stick") { 117 rowClass += " gap-lg-0"; 118 } 119 if (spaceBetweenColumns == "spacing-medium") 120 { 121 rowClass += " gap-lg-4"; 122 } 123 if (spaceBetweenColumns == "spacing-large") { 124 rowClass += " gap-lg-5"; 125 } 126127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128129 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 130 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 131 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 132 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 133 string animationOnScrollCol3 = Model.Item.GetRawValueString("AnimationOnScrollCol3", "no-animation"); 134 animationOnScrollCol3 = animationOnScrollCol3 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol3 + "'" : ""; 135 string animationOnScrollCol4 = Model.Item.GetRawValueString("AnimationOnScrollCol4", "no-animation"); 136 animationOnScrollCol4 = animationOnScrollCol4 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol4 + "'" : ""; 137 string animationOnScrollCol5 = Model.Item.GetRawValueString("AnimationOnScrollCol5", "no-animation"); 138 animationOnScrollCol5 = animationOnScrollCol5 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol5 + "'" : ""; 139 string animationOnScrollCol6 = Model.Item.GetRawValueString("AnimationOnScrollCol6", "no-animation"); 140 animationOnScrollCol6 = animationOnScrollCol6 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol6 + "'" : ""; 141142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151152 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 153 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 154 backgroundImagePath = !string.IsNullOrEmpty(backgroundImagePath) ? $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=2600&format=webp&compression=75" : string.Empty; 155 backgroundImagePath = Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(backgroundImagePath); 156 string backgroundRepeat = Model.Item.GetRawValueString("BackgroundImageRepeat", "no-repeat"); 157 string backgroundImageSize = Model.Item.GetRawValueString("BackgroundImageSize", "initial"); 158 int xPos = backgroundImage?.FocalPositionFromLeft ?? 50; 159 int yPos = backgroundImage?.FocalPositionFromTop ?? 50; 160 string cssPosition = $"{xPos}% {yPos}%"; 161 string gradient = Model.Item.GetRawValueString("Gradient", string.Empty); 162 string gradientOpacity = Model.Item.GetRawValueString("GradientOpacity", "0.00"); 163 string gradientString = "linear-gradient(" + gradient + "deg," + "rgba(var(--swift-foreground-color-rgb)," + gradientOpacity + "), rgba(var(--swift-background-color-rgb)," + gradientOpacity + "))"; 164 string backgroundImageString = "url(" + backgroundImagePath + ")"; 165 string backgroundImagePositionString = "background-position:" + cssPosition + ";"; 166 string backgroundRepeatString = "background-repeat:" + backgroundRepeat + ";"; 167 string backgroundImageSizeString = "background-size:" + backgroundImageSize + ";"; 168 string styleString = string.Empty; 169170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173174 foreach (var itemId in decorations) 175 { 176 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 177 item.TryGetValue("Class", out object classes); 178 if (classes is null) 179 { 180 continue; 181 } 182183 var cssString = (string)classes; 184 if (cssString.StartsWith("[")) 185 { 186 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 187 cssClasses.AddRange(cssArray); 188 } 189 else 190 { 191 cssClasses.Add(cssString.Replace(",", " ")); 192 } 193 } 194 css = string.Join(" ", cssClasses).Trim(); 195196 @* Only gradient *@ 197198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202203 @* Only background image *@ 204205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209210 @* Gradient and background image *@ 211212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219220 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).Output()) || !string.IsNullOrWhiteSpace(Model.Column(3).Output()) || !string.IsNullOrWhiteSpace(Model.Column(4).Output()) || !string.IsNullOrWhiteSpace(Model.Column(5).Output()) || !string.IsNullOrWhiteSpace(Model.Column(6).Output())) 221 { 222 <div class="@(sectionClass)@(theme) @(css) item_@Model.Item.SystemName.ToLower()" @styleString data-swift-gridrow> 223 <div class="@containerClass@(hideOverflow)"> 224 <div class="grid grid-@(mobileColumnSize) grid-lg-@Model.Columns.Count()@(rowClass)"> 225 <div class="g-col @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol1 style="--bs-columns:12"> 226 @Model.Column(1).Output() 227 </div> 228 <div class="g-col @(Model.Column(2).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol2 style="--bs-columns:12"> 229 @Model.Column(2).Output() 230 </div> 231 <div class="g-col @(Model.Column(3).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol3 style="--bs-columns:12"> 232 @Model.Column(3).Output() 233 </div> 234 <div class="g-col @(Model.Column(4).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol4 style="--bs-columns:12"> 235 @Model.Column(4).Output() 236 </div> 237 <div class="g-col @(Model.Column(5).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol5 style="--bs-columns:12"> 238 @Model.Column(5).Output() 239 </div> 240 <div class="g-col @(Model.Column(6).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="2" @animationOnScrollCol6 style="--bs-columns:12"> 241 @Model.Column(6).Output() 242 </div> 243 </div> 244 </div> 245 </div> 246 } 247 } 248