Exception in template (Designs\ncnielsen\eCom/Productlist/subgrouplist.cshtml): System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at CompiledRazorTemplates.Dynamic.aaecbecdffe.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
   at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
@{ string logoName = ""; string logoAlt = ""; string subgroupStartPath = ""; Dynamicweb.Ecommerce.Products.GroupService gs = new Dynamicweb.Ecommerce.Products.GroupService(); Dynamicweb.Ecommerce.Products.Group g = gs.GetGroup(GetString("Ecom:Group.ID")); Dynamicweb.Ecommerce.Products.GroupCollection gc = g.ParentGroups; if (GetLoop("Subgroups").Count() > 0) { /*logoName = GetLoop("Subgroups")[0].GetString("Ecom:Group.Name").Replace(" ","_");*/ logoName = gc[0].Name.Replace(" ","_"); if (logoName.IndexOf("_") != -1) { logoName = logoName.Substring(0,logoName.IndexOf("_")).ToLower().Replace(" ","_").Replace("/","_").Replace("æ","a").Replace("ø","o").Replace("å","a"); subgroupStartPath = logoName + "_"; logoAlt = logoName + " logo"; logoName = logoName.ToLower() + "_white"; logoName = logoName + ".png"; } else { logoName = logoName.ToLower().Replace(" ","_").Replace("/","_").Replace("æ","a").Replace("ø","o").Replace("å","a"); subgroupStartPath = logoName + "_"; logoAlt = logoName + " logo"; logoName = logoName.ToLower() + "_white"; logoName = logoName + ".png"; } } } @SnippetStart("TemplateSpecificHeader") <div class="content"> @if (logoName != "") { if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/images/ncnielsen/ecom/logos/" + logoName))) { <img id="brandlogo" src='/files/images/ncnielsen/ecom/logos/@logoName' alt='@logoAlt' /> } } <h1>@GetString("Ecom:Group.Name")</h1><span class="subheader">@GetString("Ecom:Group. ")</span></div><div id="headerImage"> @{ string headerImagefolderName = GetString("Ecom:Group.Name").ToLower().Replace(" ","_").Replace("/","_").Replace("æ","a").Replace("ø","o").Replace("å","a"); string headerImagePath = "/files/images/ncnielsen/ecom/groups/" + subgroupStartPath + "" + headerImagefolderName + "/header.jpg"; <img src='@headerImagePath' alt='@GetString("Ecom:Group.Name")' /> } </div> @SnippetEnd("TemplateSpecificHeader") <section class="section section-white section-product-list"><div class="content"><div class="filter-bar"> @RenderNavigation(new { template = "ecom-filtering.xslt", expandmode = "all", id = "ecomFiltering", startlevel = "1", endlevel = "5" }) </div><ul id="productList"> @if (GetLoop("Subgroups").Count > 0) { foreach (var ecomSubGroup in GetLoop("Subgroups")) { string folderName = ecomSubGroup.GetString("Ecom:Group.Name").ToLower().Replace(" ","_").Replace("/","_").Replace("æ","a").Replace("ø","o").Replace("å","a"); string imagePath = "/files/images/ncnielsen/ecom/groups/" + folderName + "/list.jpg"; <li class="product"><a href='/@ecomSubGroup.GetString("Ecom:Group.Link.Clean")'><img src='@imagePath' alt='@ecomSubGroup.GetString("Ecom:Group.Name")' /><h2>@ecomSubGroup.GetString("Ecom:Group.Name")</h2> @if (!string.IsNullOrWhiteSpace(@ecomSubGroup.GetString("Ecom:Group:Field.ListeLabel"))) { <p>@ecomSubGroup.GetString("Ecom:Group:Field.ListeLabel"): @ecomSubGroup.GetString("Ecom:Group:Field.ListeVaerdi.Value")</p> } </a></li> } } else { string folderName = GetString("Ecom:Group.Name").ToLower().Replace(" ","_").Replace("/","_").Replace("æ","ae").Replace("ø","oe").Replace("å","aa"); string imagePath = "/files/images/ncnielsen/ecom/groups/" + folderName + "/list.jpg"; <li class="product"><a href='/@GetString("Ecom:Group.Link.Clean")'><img src='@imagePath' alt='@GetString("Ecom:Group.Name")' /><h2>@GetString("Ecom:Group.Name")</h2> @if (!string.IsNullOrWhiteSpace(GetString("Ecom:Group:Field.ListeLabel"))) { <p>@GetString("Ecom:Group:Field.ListeLabel"): @GetString("Ecom:Group:Field.ListeVaerdi.Value")</p> } </a></li> } </ul></div></section>
På nc-nielsen.dk bruger vi cookies for at forbedre din brugeroplevelse.AccepterLæs mere om vores brug af cookies