Categories
Error executing template "Designs/DS2016/Paragraph/FrontpageSubjects.cshtml"
System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
at CompiledRazorTemplates.Dynamic.RazorEngine_ea783250dd3e47a2b24fb8a70fabf51d.Execute() in C:\home\site\wwwroot\Files\Templates\Designs\DS2016\Paragraph\FrontpageSubjects.cshtml:line 15
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.DynamicWrapperService.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 RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
2 @using Dynamicweb.Core;
3 @using Dynamicweb.Ecommerce.Products;
4
5 @{
6 var productPageLink = GetString("Item.ProductCatalogLink");
7 var categoryLoop = global::Dynamicweb.Ecommerce.Products.Group.GetGroupById("CATEGORY");
8 GroupCollection subGroupsLoop = default(GroupCollection);
9 if (categoryLoop != null)
10 {
11 subGroupsLoop = categoryLoop.Subgroups;
12 }
13 }
14
15 @if (subGroupsLoop.Any()) {
16 <div class="js-flexslider-subjects flex-subjects-container master-slider-parent ms-partialview-template">
17 <div class="master-slider ms-skin-light-4" id="js-master-slider-@GetValue("ParagraphID")">
18 @foreach(var g in subGroupsLoop.Where(g => g.NavigationShowInMenu))
19 {
20 var groupLink = productPageLink + "&GroupID=" + g.IdUrlEncoded;
21 var imageLink = !string.IsNullOrWhiteSpace(g.LargeImage.ToString()) ? "Files/" + g.LargeImage : "https://placehold.it/660x440";
22 //20160930: new custom name
23 var customName = Converter.ToString(g.ProductGroupFieldValues.GetProductGroupFieldValue("CustomName").Value);
24 var name = string.IsNullOrEmpty(customName) ? g.Name : customName;
25
26 <div class="subject-element ms-slide" data-fill-mode="fill" data-delay="3">
27
28 <div class="subject-top-container text-center ms-layer ms-caption" data-type="text" data-position="static">
29 <h3 class="subject-title">
30 <a href="@groupLink">@name</a>
31 </h3>
32 <div class="subject-description">
33 @g.Description
34 </div>
35 </div>
36 <img src="@imageLink" data-src="@imageLink" data-duration="800" />
37 <a href="@groupLink">@name</a>
38 </div>
39 }
40 </div>
41 </div>
42
43 @SnippetStart("StyleSheet")
44 <link rel='stylesheet' id='ms-main-css' href='@GetString("Template:DesignBaseUrl")/assets/plugins/master-slider/slider.css' type='text/css' media='all' />
45 @SnippetEnd("StyleSheet")
46
47 @SnippetStart("JavaScript")
48 <script src='@GetString("Template:DesignBaseUrl")/assets/plugins/master-slider/slider.js?v1.3'></script>
49 <script>
50 $(window).load(function() {
51
52 var mastersliderFront = new MasterSlider();
53
54 // slider controls
55 mastersliderFront.control('arrows' ,{ autohide:true, overVideo:true });
56 // slider setup
57 mastersliderFront.setup('js-master-slider-@GetValue("ParagraphID")', {
58 width : 440,
59 height : 293,
60 minHeight : 0,
61 space : 10,
62 grabCursor : true,
63 swipe : true,
64 mouse : true,
65 keyboard : false,
66 layout : "partialview",
67 wheel : false,
68 autoplay : true,
69 instantStartLayers:false,
70 loop : true,
71 shuffle : false,
72 preload : 0,
73 heightLimit : true,
74 autoHeight : false,
75 smoothHeight : true,
76 endPause : false,
77 overPause : true,
78 fillMode : "fill",
79 centerControls : true,
80 startOnAppear : false,
81 layersMode : "center",
82 autofillTarget : "",
83 hideLayers : false,
84 fullscreenMargin: 0,
85 speed : 20,
86 dir : "h",
87 parallaxMode : 'swipe',
88 view : "fadeBasic"
89 });
90
91
92 window.masterslider_instances = window.masterslider_instances || [];
93 window.masterslider_instances.push( mastersliderFront );
94 });
95
96 </script>
97 @SnippetEnd("JavaScript")
98 }