Error executing template "/Designs/Swift/Grid/Page/RowTemplates/2Columns.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_c5c850908b5d4dd1ba03030540b2d2eb.Execute() in D:\dynamicweb.net\Solutions\twodayco3\evasolo.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Grid\Page\RowTemplates\2Columns.cshtml:line 162
   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 3 @{ 4 string sectionClass = "py-3"; 5 string spaceBetweenRows = Model.Item.GetRawValueString("SpaceBetweenRows", "spacing"); 6 string spaceBetweenRowsMobile = Model.Item.GetRawValueString("SpaceBetweenRowsMobile", "auto"); 7 8 //Row spacing mobile auto 9 if (spaceBetweenRowsMobile == "auto") { 10 spaceBetweenRowsMobile = spaceBetweenRows; 11 } 12 13 //Row spacing mobile 14 switch (spaceBetweenRowsMobile) { 15 case "none": //No spacing 16 sectionClass = "py-0"; 17 break; 18 case "spacing": //Small spacing top and bottom 19 sectionClass = "py-3"; 20 break; 21 case "spacing-small-top": //Small spacing top 22 sectionClass = "pt-3"; 23 break; 24 case "spacing-small-bottom": //Small spacing bottom 25 sectionClass = "pb-3"; 26 break; 27 case "spacing-medium": //Medium spacing top and bottom 28 sectionClass = "py-4"; 29 break; 30 case "spacing-medium-top": //Medium spacing top 31 sectionClass = "pt-4"; 32 break; 33 case "spacing-medium-bottom": //Medium spacing bottom 34 sectionClass = "pb-4"; 35 break; 36 case "spacing-large": //Large spacing top and bottom 37 sectionClass = "py-5"; 38 break; 39 case "spacing-top": //Large spacing top 40 sectionClass = "pt-5"; 41 break; 42 case "spacing-bottom": //Large spacing bottom 43 sectionClass = "pb-5"; 44 break; 45 } 46 47 //Row spacing dekstop 48 switch (spaceBetweenRows) { 49 case "none": //No spacing 50 sectionClass += " py-lg-0"; 51 break; 52 case "spacing": //Small spacing top and bottom 53 sectionClass += " py-lg-3"; 54 break; 55 case "spacing-small-top": //Small spacing top 56 sectionClass += " pt-lg-3 pb-lg-0"; 57 break; 58 case "spacing-small-bottom": //Small spacing bottom 59 sectionClass += " pb-lg-3 pt-lg-0"; 60 break; 61 case "spacing-medium": //Medium spacing top and bottom 62 sectionClass += " py-lg-5"; 63 break; 64 case "spacing-medium-top": //Medium spacing top 65 sectionClass += " pt-lg-5 pb-lg-0"; 66 break; 67 case "spacing-medium-bottom": //Medium spacing bottom 68 sectionClass += " pb-lg-5 pt-lg-0"; 69 break; 70 case "spacing-large": //Large spacing top and bottom 71 sectionClass += " py-lg-6"; 72 break; 73 case "spacing-top": //Large spacing top 74 sectionClass += " pt-lg-6 pb-lg-0"; 75 break; 76 case "spacing-bottom": //Large spacing bottom 77 sectionClass += " pb-lg-6 pt-lg-0"; 78 break; 79 } 80 81 string containerClass = "container-xl"; 82 string width = Model.Item.GetRawValueString("Width", "container-xl"); 83 if (width == "none") 84 { 85 containerClass = "container-fluid px-0"; 86 } 87 if (width == "stretch") { 88 containerClass = "container-fluid"; 89 } 90 if (width == "compressed") { 91 containerClass = " container-compressed"; 92 } 93 94 string rowClass = string.Empty; 95 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", string.Empty).ToLower(); 96 string spaceBetweenColumnsMobile = Model.Item.GetRawValueString("SpaceBetweenColumnsMobile", string.Empty).ToLower(); 97 //Mobile 98 if (spaceBetweenColumnsMobile == "auto") 99 { 100 spaceBetweenColumnsMobile = spaceBetweenColumns; 101 } 102 if (spaceBetweenColumnsMobile == "stick") { 103 rowClass = " gap-0"; 104 } 105 if (spaceBetweenColumnsMobile == "spacing-medium") 106 { 107 rowClass = " gap-4"; 108 } 109 if (spaceBetweenColumnsMobile == "spacing-large") { 110 rowClass = " gap-5"; 111 } 112 //Desktop 113 if (spaceBetweenColumns == "stick") { 114 rowClass += " gap-lg-0"; 115 } 116 if (spaceBetweenColumns == "spacing-medium") 117 { 118 rowClass += " gap-lg-4"; 119 } 120 if (spaceBetweenColumns == "spacing-large") { 121 rowClass += " gap-lg-5"; 122 } 123 124 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 125 126 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 127 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 128 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 129 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 130 131 string hideOverflow = " overflow-hidden"; 132 hideOverflow = 133 animationOnScrollCol1 != "" || 134 animationOnScrollCol2 != "" 135 ? hideOverflow : ""; 136 137 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 138 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 139 string imagePath = $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=960&format=webp"; 140 backgroundImagePath = Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(backgroundImagePath); 141 string backgroundRepeat = Model.Item.GetRawValueString("BackgroundImageRepeat", "no-repeat"); 142 string backgroundImageSize = Model.Item.GetRawValueString("BackgroundImageSize", "initial"); 143 int xPos = backgroundImage?.FocalPositionFromLeft ?? 50; 144 int yPos = backgroundImage?.FocalPositionFromTop ?? 50; 145 string cssPosition = $"{xPos}% {yPos}%"; 146 string gradient = Model.Item.GetRawValueString("Gradient", string.Empty); 147 string gradientOpacity = Model.Item.GetRawValueString("GradientOpacity", "0.00"); 148 string gradientString = "linear-gradient(" + gradient + "deg," + "rgba(var(--swift-foreground-color-rgb)," + gradientOpacity + "), rgba(var(--swift-background-color-rgb)," + gradientOpacity + "))"; 149 string backgroundImageString = "url(" + backgroundImagePath + ")"; 150 string backgroundImagePositionString = "background-position:" + cssPosition + ";"; 151 string backgroundRepeatString = "background-repeat:" + backgroundRepeat + ";"; 152 string backgroundImageSizeString = "background-size:" + backgroundImageSize + ";"; 153 string styleString = string.Empty; 154 155 var decorations = Model.Item?.GetList("CssDecorations")?.SelectedValues ?? Enumerable.Empty<string>(); 156 var css = string.Empty; 157 var cssClasses = new List<string> { }; 158 159 foreach (var itemId in decorations) 160 { 161 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 162 item.TryGetValue("Class", out object classes); 163 if (classes is null) 164 { 165 continue; 166 } 167 168 var cssString = (string)classes; 169 if (cssString.StartsWith("[")) 170 { 171 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 172 cssClasses.AddRange(cssArray); 173 } 174 else 175 { 176 cssClasses.Add(cssString.Replace(",", " ")); 177 } 178 } 179 css = string.Join(" ", cssClasses).Trim(); 180 181 @* Only gradient *@ 182 183 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 184 { 185 styleString += "style=\"background-image:" + gradientString + ";\""; 186 } 187 188 @* Only background image *@ 189 190 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 191 { 192 styleString += "style=\"background-image:" + backgroundImageString + "," + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 193 } 194 195 @* Gradient and background image *@ 196 197 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 198 { 199 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 200 } 201 202 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 203 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 204 205 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).Output())) 206 { 207 <div class="@(sectionClass)@(theme) @(css) item_@Model.Item.SystemName.ToLower()" @styleString> 208 <div class="@containerClass@(hideOverflow)"> 209 <div class="grid grid-@(mobileColumnSize) grid-lg-@Model.Columns.Count()@(rowClass)"> 210 <div class="g-col @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="6" @animationOnScrollCol1 style="--bs-columns:12"> 211 @Model.Column(1).Output() 212 </div> 213 <div class="g-col @(Model.Column(2).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="6" @animationOnScrollCol2 style="--bs-columns:12"> 214 @Model.Column(2).Output() 215 </div> 216 </div> 217 </div> 218 </div> 219 } 220 } 221
Invite neighbourhood birds in for fine dining. The birdfeeder is topped with a decorative canopy, which not only keeps the feed dry, but also prevents large birds from making off with treats intended for small feathered friends. Thanks to the transparent glass base of the birdfeeder orb, you can easily spot at a distance when it’s time for a birdfeed refill. You also needn’t worry about maintenance: the materials are weather-resistant and designed to withstand the elements all year round.
Læs mere
Color Black
Cleaning Not dishwasher-safe, must be washed by hand.
Material Borosilicate Glass,Silicone,Stainless Steel,Steel wire
Height 15
Width 24
Depth 24
Diameter (cm) 24
Weight 0.55
Designer Tools Design
Brand Eva Solo
Number 570901
EAN 5706631252959

Related content