Exception in template (Designs\Martin\eCom/Product/Martin_v5_ProductDetails_2017.cshtml): System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
   at System.String.Substring(Int32 startIndex, Int32 length)
   at CompiledRazorTemplates.Dynamic.ebfadfceedfc.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.Output()
@using Dynamicweb @using System.Web @using System.Text.RegularExpressions @functions { public string parseSqlValue(string rawValue) { return HttpUtility.UrlDecode(rawValue); } } @{ var ProdIDRef = @GetString("Ecom:Product.ID"); String prodIdReference = "P_" + ProdIDRef; } <script src="/files/templates/designs/martin/js/2017_productpage_scripts.js?version=4"> </script> <script> $(function() { var prodDescHeight = $('#prodTop').outerHeight(); if ($(window).width() > 990) { $('.imgWrapper').css({'height': prodDescHeight, 'position': 'relative'}); $('.imgWrapperImg').css({'position':'absolute', 'bottom': '0'}); } else{ $('.imgWrapper').css({'height': 'auto', 'position': 'static'}); $('.imgWrapper img').css({'position': 'static'}); } var doit; $( window ).resize(function() { clearTimeout(doit); doit = setTimeout(relocate, 100); }); }); function relocate() { var prodDescHeight = $('.prodDescription').outerHeight(); if ($(window).width() > 990) { $('.imgWrapper').css({'height': prodDescHeight, 'position': 'relative'}); $('.imgWrapperImg').css({'position':'absolute', 'bottom': '0'}); } else{ $('.imgWrapper').css({'height': 'auto', 'position': 'static'}); $('.imgWrapper img').css({'position': 'static'}); } } </script> <script> var hasPhotometric = '@GetString("Ecom:Product.PrimaryOrFirstGroupID")'; </script> <!--@SnippetStart(isReleased)--> @{ int productIsReleased = Convert.ToInt32(GetString("Ecom:Product:Field.ProductStatus")); if(@productIsReleased == 0) { <meta name="robots" content="noindex"> } } <!--@SnippetEnd(isReleased)--> <script src="/files/templates/designs/martin/js/2017_productpage_scripts.js?version=2"> </script> <script> var prodName = '@GetString("Ecom:Product.Name")'; </script> <!-- Declare productID variable to use as parametre in razor --> @{ @* Get productid url parameter *@ string productid = System.Web.HttpContext.Current.Request.QueryString["ProductID"].ToString(); } <!-- move to Master template --> <link rel="stylesheet" href="/Files/Templates/Designs/Martin/css/bootstrap.css"> <link rel="stylesheet" href="/Files/Templates/Designs/Martin/css/owl.carousel.min.css"> <link rel="stylesheet" href="/Files/Templates/Designs/Martin/css/owl.theme.default.css"> <link rel="stylesheet" href="/Files/Templates/Designs/Martin/css/ProductPage2017.css?version=15"> <link <link href="https://fonts.googleapis.com/css?family=Roboto:300i,400,400i,500,700" rel="stylesheet"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="/files/templates/designs/martin/js/owl.carousel.js"></script> <script src="/files/templates/designs/martin/js/owl.navigation.js"></script> <script type="text/javascript" src="/Files/Templates/Designs/Martin/js/jqueryfancybox.js"></script> <script type="text/javascript" src="/Files/Templates/Designs/Martin/js/jqueryfancybox-thumbs.js"></script> <link rel="stylesheet" src="/files/templates/designs/martin/css/flyttesImedia.css?version=1"> <section id="prodTop"> <div class="container-fluid"> <div class="col-lg-4 col-md-5 col-sm-10 col-xs-8 npl imgOuter"> <div class="imgWrapper"> <div class="imgWrapperImg" style="height: 100%; background: url(/admin/public/getimage.ashx?Image=@GetString("Ecom:Product.ImageLarge.Clean")&width=514&height=652&Compression=90&Format=jpg&Crop=5); background-repeat: no-repeat;"> <img alt="" style="display: none;" class="img-responsive" src="/admin/public/getimage.ashx?Image=@GetString("Ecom:Product.ImageLarge.Clean")&width=514&height=652&Compression=90&Format=jpg&Crop=5" /> </div> </div> </div> <div class="col-lg-8 col-md-7 col-sm-12 col-xs-12 npr prodDescription"> <div class="col-lg-12 col-md-12 col-sm-12 npl npr"> <div class="col-lg-11 col-md-11 col-sm-11 col-xs-12"> @if(GetString("Ecom:Product:Field.SubHeader").Length > 0) { <h2>@GetString("Ecom:Product:Field.SubHeader")</h2> } <h1>@GetString("Ecom:Product.Name")</h1> <div class="prodDesc"> @if(GetString("Ecom:Product.ShortDescription").Length > 1) { @GetString("Ecom:Product.ShortDescription") } </div> </div> @if(GetString("Ecom:Product:Field.SellingPoints").Length > 0) { <div id="prodSellingPoints" class="col-lg-12 col-md-12 col-sm-12 col-xs-12 npr"> @GetString("Ecom:Product:Field.SellingPoints") </div> } <div class="prodBtns col-lg-12 col-md-12 col-md-offset-0 col-sm-12 col-xs-12"> <a class="prodBtn" href="/default.aspx?ID=7135" class="WhereToFindGlobal"> <div class="btnImgContainer"><img src="/files/templates/designs/martin/images/design/Find.svg" width="60" /></div><span>Where<br> to find</span></a> <a class="printBtn prodBtn" href="#" > <div class="btnImgContainer"><img src="/files/templates/designs/martin/images/design/Download.svg" width="60" /></div><span>Page<br> as pdf</span></a> <a class="prodBtn" href="/default.aspx?ID=2033&productid=@GetString("Ecom:Product.ID")"> <div class="btnImgContainer"><img src="/files/templates/designs/martin/images/design/Support.svg" width="60" /></div><span>support &<br> downloads</span></a> @if (GetString("Ecom:Product:Field.Photometric")!="") { if( @GetString("Ecom:Product:Field.Photometric") != "None") { <a class="prodBtn photometricBtn Photometric" href="/default.aspx?ID=1433&Photometric=@GetString("Ecom:Product:Field.ProductIdEcom")"> <div class="btnImgContainer"><img src="/files/templates/designs/martin/images/design/PhotometricsBtn.svg" width="60" /></div><span>Photo-<br>metric</span> </a> } if( @GetString("Ecom:Product:Field.Photometric") == "None") { <a class="prodBtn photometricBtn Photometric" href="default.aspx?ID=2033&productid=@GetString("Ecom:Product.ID")"> <div class="btnImgContainer"><img src="/files/templates/designs/martin/images/design/PhotometricsBtn.svg" width="60" /></div><span>Photo-<br>metric</span> </a> } } </div> </div> </div> </div> </section> <section id="gallery"> <div class="container-fluid"> <div class="col-lg-10 col-md-10 col-sm-10 col-lg-offset-1 col-md-offset-1 col-sm-offset-1"> <ul class="galleryList listSli" id="listGallery" style="display:none;" > @RenderItemList(new { ItemType = "Downloads", ListSourceType = "Area", ListSourceArea = 1, IncludeParagraphItems = true, ItemFieldsList = "*", ListTemplate = "ItemPublisher/List/productVideos.cshtml", ListPageSize = 3, Filter = "ProductLink contains \""+prodIdReference+"\"" }) @foreach (LoopItem i in GetLoop("Details")) { <li class="GalleryItem col-lg-4 col-md-6 col-sm-12 col-xs-12 np"> <div class="listImgContainer"> <a class="fancybox-thumb" rel="fancybox-thumb" href="@i.GetString("Ecom:Product:Detail.Image.Clean")" title=""> <img src="/admin/public/getimage.ashx?Image=@i.GetString("Ecom:Product:Detail.Image.Clean")&height=500&Compression=90&Format=jpg&Crop=5" alt="" /> </a> </div> </li> } </ul> </div> </div> </section> <div id="submenu"> <div class="submenu"> <div class="container"> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <ul class="clearfix submenuList"> <li> <a class="navbenefits" href="#benefits">Highlights</a> </li> <li> <a class="navfeatures" href="#features">Features</a> </li> <li> <a class="navreferences" href="#references">References</a> </li> <li> <a class="navtechSpecs" href="#techSpecs">Tech specs</a> </li> <!-- <li> <a class="navAccessories" href="#Accessories">Accessories</a> </li> --> <li> <a class="navdownloads" href="#downloads">Downloads</a> </li> </ul> </div> </div> </div> </div> </div> <section id="benefits"> <ul class="benefitList listSli" id="benefitsList" style="display:none;"> @RenderItemList(new { ItemType = "Benefits", ListSourceType = "Area", ListSourceArea = 1, IncludeParagraphItems = true, ItemFieldsList = "BenefitsList", ListTemplate = "ItemPublisher/List/productBenefits.cshtml", ListPageSize = 3, Filter = "ProductLink contains \""+prodIdReference+"\"" }) </ul> </section> <section id="features"> <div class="container-fluid"> <div class="row"> <h1 class="sectionHeader">Features</h1> @{ var featuresBgTop = @GetValue("Ecom:Product:Field.featuresBgTop.Value.Clean"); } <div class="featuresContainer fullBg sectionPad clearfix bgGrey" style="background: url(@featuresBgTop)"> <div class="col-lg-5 col-lg-offset-5 col-md-5 col-md-offset-5 col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1 infoBox"> @if(GetString("Ecom:Product:Field.BulletPoints").Length > 0) { @GetString("Ecom:Product:Field.BulletPoints") } @if(GetString("Ecom:Product:Field.BulletPoints").Length == 0) { <ul> @{ MartinAPI.Product.Parts bulletpointObj = new MartinAPI.Product.Parts(); var bulletpointsFeatures = bulletpointObj.GetBulletPointsByProductIdLanguage(productid, "LANG1"); foreach(var bp2 in bulletpointsFeatures) { <li class="">@bp2.BulletPoint</li> } } </ul> } </div> </div> @if(GetString("Ecom:Product:Field.featuresImg").Length > 0 || GetString("Ecom:Product:Field.featuresBg").Length > 0 ) { var featureBg = @GetValue("Ecom:Product:Field.featuresBg.Value.Clean"); var featureImg = @GetValue("Ecom:Product:Field.featuresImg.Value.Clean"); <div class="featuresContainerBottom fullBg clearfix" style="background-image: url(@featureBg)"> <div class="col-lg-5 col-lg-offset-2"><img alt="" class="img-responsive" src="@featureImg"></div> </div> } </div> </div> </section> <section class="mh" id="references"> <div class="container-fluid"> <div class="row"> <h1 class="sectionHeader">References</h1> <div class="col-lg-10 col-md-10 col-sm-10 col-lg-offset-1 col-md-offset-1 col-sm-offset-1"> <ul class="prodArt sliderList refList listSli" id="listReference" style="display:none;"> @RenderItemList(new { ItemType = "CaseStory", ListSourceType = "Area", ListSourceArea = 1, IncludeParagraphItems = true, ItemFieldsList = "Image,Title,Text", ListTemplate = "ItemPublisher/List/productReferences.cshtml", ListPageSize = 20, Filter = "RelatedProducts contains \""+prodIdReference+"\"" }) @{ MartinAPI.Product.Parts refObj = new MartinAPI.Product.Parts(); var referencer = refObj.GetReferencesByProductIdLanguage(productid, "LANG1"); foreach(var refe in referencer.Distinct()) { var rtText = @refe.Text.Substring(0, 250); var noFormatterRefText = Regex.Replace(rtText, "<.*?>", String.Empty); <li class="col-lg-4 col-md-6 col-sm-12 col-xs-12"> <a href="/default.aspx?ID=217&pid=13699&itemId=CaseStory:@refe.ReferenceId"> <div class="imgContainer fullBg" style="background: url(/admin/public/getimage.ashx?Image=@refe.ReferenceImage&width=320&height=300&Compression=90&Format=jpg&Crop=5)"></div><span class="smalColHeader cw">@refe.ReferenceTitle</span> <div class="prodArtText"> @noFormatterRefText.Substring(0, 150).. </div> </a> </li> } } </ul> </div> </div> </div> </section> <section class="mh bgGrey" id="techSpecs"> <div class="container-fluid"> <div class="row"> <h1 class="sectionHeader bgGrey">Tech specs</h1> </div> <div class="row"> @{ var specsIllu = @GetValue("Ecom:Product:Field.specsBg.Value.Clean"); } <div class="col-lg-2 col-md-2 col-sm-2 Specsbg npl"> @if(@GetString("Ecom:Product:Field.specsBg.Value.Clean").Length > 0) { <img alt="" class="img-responsive specIllu" src="@specsIllu"> } </div> @{ if(GetString("Ecom:Product:Field.TempSpecs").Length < 1) { int categoryCount = GetInteger("Firstweb.ProductSpecCategories.Count"); var categories = GetLoop("Firstweb.ProductSpecCategories"); int left = categoryCount / 2; //Left <div class="col-lg-4 col-md-4 col-sm-4 specsCol1"> @for (int i = 0; i < @left; i++) { var category = categories[i]; <div class="spec clearfix"> <span class="smalColHeader cw">@category.GetString("CategoryName")</span> @foreach(var spec in @category.GetLoop("Firstweb.ProductSpecs")) { var specTypeName = @spec.GetString("TypeName"); var testVar = @spec.GetString("SpecValue"); <span class="specContent"> @{ string hasSpecValue = @spec.GetString("SpecLabel").ToString(); } @if(@hasSpecValue.Length > 0) { <span class="specLabel @specTypeName">@spec.GetString("SpecLabel"): <span class="specVal">@spec.GetString("SpecValue")</span></span> } else { <span class="specLabel @specTypeName">@spec.GetString("SpecLabel") <span class="specVal">@spec.GetString("SpecValue")</span></span> } </span> } </div> } </div> //Right <div class="col-lg-4 col-lg-offset-1 col-md-4 col-md-offset-1 col-sm-4 col-sm-offset-1 specsCol2"> @for (int i = @left; i < @categoryCount; i++) { var category = categories[i]; <div class="spec clearfix"> <span class="smalColHeader cw">@category.GetString("CategoryName")</span> @foreach(var spec in @category.GetLoop("Firstweb.ProductSpecs")) { var specTypeName = @spec.GetString("TypeName"); <span class="specContent"> <span class="specContent" style="clear:both;"> @{ string hasSpecValue = @spec.GetString("SpecLabel").ToString(); } @if(@hasSpecValue.Length > 0) { <span class="specLabel @specTypeName" style="float:left">@spec.GetString("SpecLabel"): <span class="specVal">@spec.GetString("SpecValue")</span></span> } else { <span class="specLabel @specTypeName" style="float:left">@spec.GetString("SpecLabel") <span class="specVal">@spec.GetString("SpecValue")</span></span> } </span> </span> } </div> } </div> }//Temp spec if(GetString("Ecom:Product:Field.Approvals.Value").Length > 1) { <!--@LoopStart(CustomFields)--> <div class="spec approval"> <!-- <span class="specHeader">Approvals</span> --> <div style="padding: 10px 0px 0 0px; display: block; margin-top: 0px; clear:both;"> @{ var approvalArray = @GetString("Ecom:Product:Field.Approvals.Value").ToString(); string[] Approvalsplit = approvalArray.Split(','); } @foreach (string approval in Approvalsplit) { var approvalsrc = "/admin/public/getimage.ashx?Image=/files/images/products/approvals/" + @approval + ".png&height=30&Format=png"; <img src="@approvalsrc" title="@approval" /> } </div> </div> <!--@LoopEnd(CustomFields)--> } } </div> </div> </section> <!-- <section class="secLightBg" id="Accessories"> <div class="container-fluid"> <div class="row"> <h1 class="sectionHeader">Accessories</h1> <div class="col-lg-10 col-md-10 col-sm-10 col-lg-offset-1 col-md-offset-1 col-sm-offset-1"> <ul class="prodArt sliderList listSli"> <li class="col-lg-4 col-md-6 col-sm-12 col-xs-12 np"> <div class="imgContainer fullBg" style="background: url(dummy/ref-1.jpg)"></div> </li> <li class="col-lg-4 col-md-6 col-sm-12 col-xs-12 np"> <div class="imgContainer fullBg" style="background: url(dummy/ref-1.jpg)"></div> </li> <li class="col-lg-4 col-md-6 col-sm-12 col-xs-12 np"> <div class="imgContainer fullBg" style="background: url(dummy/ref-1.jpg)"></div> </li> </ul> </div> </div> </div> </section> --> @RenderItemList(new { ItemType = "Downloads", ListSourceType = "Area", ListSourceArea = 1, IncludeParagraphItems = true, ItemFieldsList = "*", ListTemplate = "ItemPublisher/List/productDownloads.cshtml", ListPageSize = 3, Filter = "ProductLink contains \""+prodIdReference+"\"" }) <section id="Solutions"> <div class="container-fluid"> <div class="row"> <h1 class="sectionHeader">Solutions</h1> </div> </div> <div class="container"> <div class="row"> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12"> <a href="http://pro.harman.com/applications/entertainment?webSyncID=0bd79781-71d3-49ea-b2b0-66e835d0017b&amp;sessionGUID=b92d31e9-b8a3-c4b3-9cb8-61cb7457d817" target="_blank"><img class="solImg" src="/Files/Templates/Designs/Martin/images/productPage/proSolutions/ProSolutionButtonEntertainment.jpg" alt=""></a> </div> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12"> <a href="http://pro.harman.com/applications/enterprise?webSyncID=0bd79781-71d3-49ea-b2b0-66e835d0017b&amp;sessionGUID=b92d31e9-b8a3-c4b3-9cb8-61cb7457d817" target="_blank"><img class="solImg" src="/Files/Templates/Designs/Martin/images/productPage/proSolutions/ProSolutionButtonEnterprise.jpg" alt=""></a> </div> </div> </div> </section> <div id="whereToBuyContainer" class="container" style="display:none;"> <div class="close"></div> <div class="whereToGlobal"> <h2>Global locator</h2> <div class="whereToItem"> <a href="/default.aspx?ID=7135" class="WhereToFindGlobal"> <img src="/files/images/WhereToBuy/WhereToLogo.png" /> </a> </div> </div> <div class="whereToUS"> <h2>Online sales (US only)</h2> @{ var whereTo = Martin.Extender.Product.Download.PDF.GetPDFs(@productid,"LANG1"); foreach (var whereToitem in whereTo) { string isWhereToLink = Martin.Extender.Product.Download.Helper.GetItemValueString("WhereToBuyLink", whereToitem); string whereToTitle = Martin.Extender.Product.Download.Helper.GetItemValueString("PDFTitle", whereToitem); string whereToThumbnail = Martin.Extender.Product.Download.Helper.GetItemValueString("PDFThumbnail", whereToitem); if(@isWhereToLink !=""){ <div class="whereToItem"> <a href="@isWhereToLink" target="_blank" style="display: inline-block"> <img src="@whereToThumbnail" alt="@whereToTitle"> </a> </div> } } } </div> </div> @{ int productStatus = Convert.ToInt32(GetString("Ecom:Product:Field.ProductStatus")); if(@productStatus == 2) { <!-- <img src="/files/templates/designs/martin/images/productList/comingsoon_sticker.png" alt="" style="position: absolute; top: 0%; left: 0; width: 50%; height: auto;"> --> } if(@productStatus == 1) { <!-- <img src="/files/templates/designs/martin/images/productList/discontinued_sticker.png" alt="" style="position: absolute; top: 0%; left: 0; width: 50%; height: auto;"> --> } }