Error executing template "Designs/ProNails_generated/Paragraph/FooterWidgetUSPs.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_3c210d7b19d64bbf847879c2cd466220.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\pronails.cloud.dynamicweb-cms.com\files\Templates\Designs\ProNails_generated\Paragraph\FooterWidgetUSPs.cshtml:line 29
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.ParagraphViewModel>
2 @using System.IO;
3 @using System.Web;
4 @using Dynamicweb;
5 @using Dynamicweb.Content.Items;
6 @using Bluedesk.DynamicWeb.ItemTypes;
7 @using Bluedesk.DynamicWeb.ItemTypes.Configuration;
8 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration;
9
10 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution;
11 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend;
12
13
14 @{
15
16 string paragraphID = Model.ItemId;
17 FooterWidgetUSPs _data = Dynamicweb.Services.Items.GetItem("FooterWidgetUSPs", paragraphID).ToCodeFirstItem<FooterWidgetUSPs>();
18
19 var colorService = new ColorSwatchService();
20
21 BaseSettingsObj BaseSettings = (BaseSettingsObj) HttpContext.Current.Session["BaseSettings"];
22
23 string USP_text_color = colorService.GetHexColor(Pageview.AreaID, _data.TopUSPTextColor.ToString());
24 string USP_icon_color = colorService.GetHexColor(Pageview.AreaID, _data.TopUSPIconColor.ToString());
25
26 }
27
28 <ul class="usp__list">
29 @RenderHeaderUSP(BaseSettings.USP.USP_1, BaseSettings.USP.USP_1_icon, paragraphID, _data.fontawesomeStyle)
30 @RenderHeaderUSP(BaseSettings.USP.USP_2, BaseSettings.USP.USP_2_icon, paragraphID, _data.fontawesomeStyle)
31 @RenderHeaderUSP(BaseSettings.USP.USP_3, BaseSettings.USP.USP_3_icon, paragraphID, _data.fontawesomeStyle)
32 @RenderHeaderUSP(BaseSettings.USP.USP_4, BaseSettings.USP.USP_4_icon, paragraphID, _data.fontawesomeStyle)
33 @RenderHeaderUSP(BaseSettings.USP.USP_5, BaseSettings.USP.USP_5_icon, paragraphID, _data.fontawesomeStyle)
34 </ul>
35
36 <style>
37 .usp__item--@paragraphID {
38 color: @USP_text_color;
39 }
40
41 .usp__item--@paragraphID svg,
42 .usp__item--@paragraphID i{
43 color: @USP_icon_color;
44 }
45 </style>
46
47 @helper RenderHeaderUSP(string USP_content, string USP_icon, string paragraphID, string fas)
48 {
49 if (!string.IsNullOrWhiteSpace(USP_content))
50 {
51 var usp_icon_class = (!string.IsNullOrWhiteSpace(USP_icon)) ? USP_icon : fas + " fa-check";
52
53 <li class="usp__item usp__item--@paragraphID">
54 <i class="@usp_icon_class usp__icon"></i>
55 <span>@USP_content</span>
56 </li>
57 }
58 }
59