Tak
Thank you for creating the account. Please check your email.
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/4ColumnsFlex_Custom.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_8f9a610f37a74d3faeb9ff32ce8ae859.Execute() in D:\dynamicweb.net\Solutions\twodayco3\carbi.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Grid\Page\RowTemplates\4ColumnsFlex_Custom.cshtml:line 76 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 5 string containerClass = "container-xl"; 6 7 string width = Model.Item.GetRawValueString("Width", "").ToLower(); 8 if (width == "stretch") 9 { 10 containerClass = "container-fluid"; 11 } 12 if (width == "none") 13 { 14 containerClass = "overflow-hidden"; 15 } 16 17 string rowClass = "gap-3"; 18 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", "").ToLower(); 19 20 if (spaceBetweenColumns == "stick") 21 { 22 rowClass = "gap-0"; 23 } 24 if (spaceBetweenColumns == "spacing-large") 25 { 26 rowClass = "gap-1 gap-md-4 gap-lg-5"; 27 } 28 29 string columnPosition = Model.Item.GetRawValueString("columnPosition", "align-items-center").ToLower(); 30 if (columnPosition == "top") 31 { 32 columnPosition = "align-items-start"; 33 } 34 if (columnPosition == "center") 35 { 36 columnPosition = "align-items-center"; 37 } 38 if (columnPosition == "bottom") 39 { 40 columnPosition = "align-items-end"; 41 } 42 43 string rowHeight = Model.Item.GetRawValueString("RowHeight", "0").ToLower(); 44 rowHeight = "py-" + rowHeight; 45 46 string column1width = Model.Item.GetRawValueString("Column_1Width", "").ToLower(); 47 column1width = column1width == "grow" ? "flex-grow-1" : "flex-grow-0"; 48 49 string column2width = Model.Item.GetRawValueString("Column_2Width", "").ToLower(); 50 column2width = column2width == "grow" ? "flex-grow-1" : "flex-grow-0"; 51 52 string column3width = Model.Item.GetRawValueString("Column_3Width", "").ToLower(); 53 column3width = column3width == "grow" ? "flex-grow-1" : "flex-grow-0"; 54 55 string column4width = Model.Item.GetRawValueString("Column_4Width", "").ToLower(); 56 column4width = column4width == "grow" ? "flex-grow-1" : "flex-grow-0"; 57 58 string hideOnScroll = Model.Item.GetRawValueString("HideOnScroll", "").ToLower(); 59 hideOnScroll = hideOnScroll == "hide" ? "js-hide-on-scroll" : ""; 60 61 string theme = string.Empty; 62 string alternativeTheme = string.Empty; 63 string mainTheme = string.Empty; 64 65 string headerCssClass = "sticky-top"; 66 if (Pageview.Page.PropertyItem != null) { 67 headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; 68 } 69 headerCssClass = headerCssClass == "" ? "sticky-top" : headerCssClass; 70 headerCssClass = Pageview.IsVisualEditorMode ? "" : headerCssClass; 71 72 string themeSwitchers = ""; 73 string themeAnimated = ""; 74 75 76 if (Pageview.Page.PropertyItem["Theme"] != null) 77 { 78 mainTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 79 theme = "theme " + Pageview.Page.PropertyItem["Theme"].ToString(); 80 alternativeTheme = "theme " + Pageview.Page.PropertyItem["Theme"].ToString(); 81 82 if (Dynamicweb.Context.Current.Request["ProductID"] != null) 83 { 84 // Quickfix - hardcoded for now .. Might be better to get values from GetPageIdByNavigationTag("ProductDetailPage") later on 85 // Reported as a DW bug 86 mainTheme = "theme theme-white"; 87 theme = "theme theme-white"; 88 alternativeTheme = "theme theme-white"; 89 } 90 } 91 else 92 { 93 mainTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 94 theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 95 alternativeTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 96 } 97 98 themeSwitchers = "data-main-theme=\"" + mainTheme + "\" data-alternative-theme=\"" + alternativeTheme + "\""; 99 themeAnimated = "theme-animated "; 100 101 102 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())) 103 { 104 105 <div class="@rowHeight @themeAnimated @theme @hideOnScroll item_@Model.Item.SystemName.ToLower()" @themeSwitchers> 106 <div class="@containerClass"> 107 <div class="d-flex flex-row @rowClass @columnPosition"> 108 <div class="col @column1width"> 109 @Model.Column(1).Output() 110 </div> 111 <div class="col @column2width"> 112 @Model.Column(2).Output() 113 </div> 114 <div class="col @column3width"> 115 @Model.Column(3).Output() 116 </div> 117 <div class="col @column4width"> 118 @Model.Column(4).Output() 119 </div> 120 </div> 121 </div> 122 </div> 123 } 124 } 125
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/4ColumnsFlex_Custom.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_8f9a610f37a74d3faeb9ff32ce8ae859.Execute() in D:\dynamicweb.net\Solutions\twodayco3\carbi.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Grid\Page\RowTemplates\4ColumnsFlex_Custom.cshtml:line 76 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 5 string containerClass = "container-xl"; 6 7 string width = Model.Item.GetRawValueString("Width", "").ToLower(); 8 if (width == "stretch") 9 { 10 containerClass = "container-fluid"; 11 } 12 if (width == "none") 13 { 14 containerClass = "overflow-hidden"; 15 } 16 17 string rowClass = "gap-3"; 18 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", "").ToLower(); 19 20 if (spaceBetweenColumns == "stick") 21 { 22 rowClass = "gap-0"; 23 } 24 if (spaceBetweenColumns == "spacing-large") 25 { 26 rowClass = "gap-1 gap-md-4 gap-lg-5"; 27 } 28 29 string columnPosition = Model.Item.GetRawValueString("columnPosition", "align-items-center").ToLower(); 30 if (columnPosition == "top") 31 { 32 columnPosition = "align-items-start"; 33 } 34 if (columnPosition == "center") 35 { 36 columnPosition = "align-items-center"; 37 } 38 if (columnPosition == "bottom") 39 { 40 columnPosition = "align-items-end"; 41 } 42 43 string rowHeight = Model.Item.GetRawValueString("RowHeight", "0").ToLower(); 44 rowHeight = "py-" + rowHeight; 45 46 string column1width = Model.Item.GetRawValueString("Column_1Width", "").ToLower(); 47 column1width = column1width == "grow" ? "flex-grow-1" : "flex-grow-0"; 48 49 string column2width = Model.Item.GetRawValueString("Column_2Width", "").ToLower(); 50 column2width = column2width == "grow" ? "flex-grow-1" : "flex-grow-0"; 51 52 string column3width = Model.Item.GetRawValueString("Column_3Width", "").ToLower(); 53 column3width = column3width == "grow" ? "flex-grow-1" : "flex-grow-0"; 54 55 string column4width = Model.Item.GetRawValueString("Column_4Width", "").ToLower(); 56 column4width = column4width == "grow" ? "flex-grow-1" : "flex-grow-0"; 57 58 string hideOnScroll = Model.Item.GetRawValueString("HideOnScroll", "").ToLower(); 59 hideOnScroll = hideOnScroll == "hide" ? "js-hide-on-scroll" : ""; 60 61 string theme = string.Empty; 62 string alternativeTheme = string.Empty; 63 string mainTheme = string.Empty; 64 65 string headerCssClass = "sticky-top"; 66 if (Pageview.Page.PropertyItem != null) { 67 headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; 68 } 69 headerCssClass = headerCssClass == "" ? "sticky-top" : headerCssClass; 70 headerCssClass = Pageview.IsVisualEditorMode ? "" : headerCssClass; 71 72 string themeSwitchers = ""; 73 string themeAnimated = ""; 74 75 76 if (Pageview.Page.PropertyItem["Theme"] != null) 77 { 78 mainTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 79 theme = "theme " + Pageview.Page.PropertyItem["Theme"].ToString(); 80 alternativeTheme = "theme " + Pageview.Page.PropertyItem["Theme"].ToString(); 81 82 if (Dynamicweb.Context.Current.Request["ProductID"] != null) 83 { 84 // Quickfix - hardcoded for now .. Might be better to get values from GetPageIdByNavigationTag("ProductDetailPage") later on 85 // Reported as a DW bug 86 mainTheme = "theme theme-white"; 87 theme = "theme theme-white"; 88 alternativeTheme = "theme theme-white"; 89 } 90 } 91 else 92 { 93 mainTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 94 theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 95 alternativeTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 96 } 97 98 themeSwitchers = "data-main-theme=\"" + mainTheme + "\" data-alternative-theme=\"" + alternativeTheme + "\""; 99 themeAnimated = "theme-animated "; 100 101 102 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())) 103 { 104 105 <div class="@rowHeight @themeAnimated @theme @hideOnScroll item_@Model.Item.SystemName.ToLower()" @themeSwitchers> 106 <div class="@containerClass"> 107 <div class="d-flex flex-row @rowClass @columnPosition"> 108 <div class="col @column1width"> 109 @Model.Column(1).Output() 110 </div> 111 <div class="col @column2width"> 112 @Model.Column(2).Output() 113 </div> 114 <div class="col @column3width"> 115 @Model.Column(3).Output() 116 </div> 117 <div class="col @column4width"> 118 @Model.Column(4).Output() 119 </div> 120 </div> 121 </div> 122 </div> 123 } 124 } 125
Thank you for creating the account. Please check your email.