SUPPLIERS
Welcome to our Suppliers page, where quality meets reliability in the plastics industry. Each supplier listed on our website represents the pinnacle of excellence, innovation, and trustworthiness.
We understand that the backbone of our product offerings lies in the strength of our partnerships with these esteemed suppliers. From global leaders to specialized niche providers, our diverse range of suppliers ensures that we cater to all your industry needs with utmost precision and quality.
Dive into the world of our suppliers, where each name is synonymous with quality and customer satisfaction
MOULDPRO
Precision in Plastics: Innovating Your Moulding Experience
Discover Precision and Innovation with MOULDPRO - Your Expert in Plastic Injection Moulding Solutions.
At MOULDPRO, we specialize in elevating the art of plastic injection moulding. Our extensive range of products, including mould sprays, consumables, water couplings, specialist tools, and accessories, is meticulously crafted to meet the dynamic needs of moulding professionals. Our commitment goes beyond just supplying products; we are dedicated to delivering excellence in every item we offer.
Partnering with a network of knowledgeable and carefully chosen distributors, MOULDPRO ensures not only the availability of premium products but also a wealth of industry expertise and outstanding customer service. Our dedication to quality is unwavering, as evidenced by our competitive pricing and attentive response to customer feedback, which drives the continual evolution of our product line.
A notable testament to our innovation is the development of Quick Mould Change (QMC) products, specifically designed to address the unique challenges of the industry. MOULDPRO, while valuing personalized attention and care, stands as a significant and established supplier with years of accumulated experience in the plastics sector. Our strategy is centered on providing top-quality products timely, ensuring value for money, and maintaining a robust global presence through our distribution network.
We invite you to explore our catalogue, confident that you will find the perfect solutions for your applications. Your satisfaction fuels our motivation to improve and excel every day. Welcome to MOULDPRO, where quality meets innovation in the world of plastic injection moulding.
Flosense
Introducing Flosense: Your Partner in Advanced Moulding Solutions.
At Flosense, we specialize in enhancing the efficiency and precision of the injection moulding process. Our focus is on developing innovative monitoring systems that are not just affordable and flexible, but also crucial for ensuring the highest standards of quality and performance in moulding operations. Our solutions are designed for easy installation and user-friendliness, making them an ideal choice for moulders who prioritize both cost-effectiveness and superior output.
Flosense is more than just a product - it's a commitment to excellence in the moulding industry. By providing reliable and insightful monitoring of key process parameters, we help our clients achieve unmatched stability and efficiency in their operations. Join us in embracing a future of moulding perfection with Flosense at your side.
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_fc7b3362ec6c489fbd913d0a1564fe93.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\HCTswift.staging.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 } 126 127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128 129 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 + "'" : ""; 141 142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151 152 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; 169 170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173 174 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 } 182 183 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(); 195 196 @* Only gradient *@ 197 198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202 203 @* Only background image *@ 204 205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209 210 @* Gradient and background image *@ 211 212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216 217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219 220 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_fc7b3362ec6c489fbd913d0a1564fe93.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\HCTswift.staging.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 } 126 127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128 129 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 + "'" : ""; 141 142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151 152 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; 169 170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173 174 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 } 182 183 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(); 195 196 @* Only gradient *@ 197 198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202 203 @* Only background image *@ 204 205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209 210 @* Gradient and background image *@ 211 212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216 217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219 220 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_fc7b3362ec6c489fbd913d0a1564fe93.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\HCTswift.staging.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 } 126 127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128 129 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 + "'" : ""; 141 142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151 152 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; 169 170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173 174 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 } 182 183 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(); 195 196 @* Only gradient *@ 197 198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202 203 @* Only background image *@ 204 205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209 210 @* Gradient and background image *@ 211 212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216 217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219 220 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_fc7b3362ec6c489fbd913d0a1564fe93.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\HCTswift.staging.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 } 126 127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128 129 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 + "'" : ""; 141 142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151 152 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; 169 170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173 174 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 } 182 183 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(); 195 196 @* Only gradient *@ 197 198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202 203 @* Only background image *@ 204 205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209 210 @* Gradient and background image *@ 211 212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216 217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219 220 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_fc7b3362ec6c489fbd913d0a1564fe93.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\HCTswift.staging.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 } 126 127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128 129 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 + "'" : ""; 141 142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151 152 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; 169 170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173 174 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 } 182 183 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(); 195 196 @* Only gradient *@ 197 198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202 203 @* Only background image *@ 204 205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209 210 @* Gradient and background image *@ 211 212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216 217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219 220 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_fc7b3362ec6c489fbd913d0a1564fe93.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\HCTswift.staging.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 } 126 127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128 129 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 + "'" : ""; 141 142 string hideOverflow = " overflow-hidden"; 143 hideOverflow = 144 animationOnScrollCol1 != "" || 145 animationOnScrollCol2 != "" || 146 animationOnScrollCol3 != "" || 147 animationOnScrollCol4 != "" || 148 animationOnScrollCol5 != "" || 149 animationOnScrollCol6 != "" 150 ? hideOverflow : ""; 151 152 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; 169 170 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 171 var css = string.Empty; 172 var cssClasses = new List<string> { }; 173 174 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 } 182 183 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(); 195 196 @* Only gradient *@ 197 198 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 199 { 200 styleString += "style=\"background-image:" + gradientString + ";\""; 201 } 202 203 @* Only background image *@ 204 205 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 206 { 207 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 208 } 209 210 @* Gradient and background image *@ 211 212 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 213 { 214 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 215 } 216 217 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 218 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 219 220 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