ASPX templates
Version 5.x > ASPX templates > Lightbox in Transformation View modes: 
User avatar
Member
Member
jeremy-salespad - 10/4/2010 9:41:06 AM
   
Lightbox in Transformation
I have been trying to get the Lightbox Gallery working from a transformation and I am having a few problems getting it working. I have product page template that has a repeater for Product Benefits(custom doc type) and in the transformation for the Product Benefits I have a repeater for Supporting Features(custom doc type).

That part works quite well, but then I try to add a Attachment Gallery to the transformation for the Supporting feature I get an error; "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)."

here is the top of the stack:
[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
System.Web.UI.ControlCollection.Add(Control child) +11019898
CMS.Controls.LightboxExtender.OnPreRender(EventArgs e) +318

I can't seem to get to the cause of it and I was wondering if anyone else had any ideas. Thanks!

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/7/2010 5:19:54 AM
   
RE:Lightbox in Transformation
Hi,

1. Could you please show us your transformation?
2. What kind of attachments are you using: unsorted attachments or grouped attachments?

Best regards,
Ivana Tomanickova

User avatar
Member
Member
jeremy-salespad - 10/7/2010 7:08:07 AM
   
RE:Lightbox in Transformation
Thanks for the reply. Here are the transformations from my current setup.

<div class="bigBenefit">
<a name="<%# Eval("Title") %>"></a>
<h3>
<%# Eval("Title") %>
</h3>
<%# Eval("Description") %>
<cms:CMSRepeater OrderBy="NodeOrder" ID="SupportingFeatureRepeater" runat="server" ClassNames="custom.supporting_feature" TransformationName="custom.supporting_feature.Default" Path='<%#Eval("NodeAliasPath")+"/%"%>' NestedControlsId="ScreenshotRepeater"></cms:CMSRepeater>
</div>


Here is the transformation from the supporting feature:

<%@ Register Src="~/CMSInlineControls/AttachmentLightboxGallery.ascx" TagName="AttachmentLightboxGallery" TagPrefix="cms" %>
<div class="supportingFeature">
<div class="screenShots">
<div class="ScreenShotGallery">
<cms:AttachmentLightboxGallery ID="AttachmentLightboxGallery" runat="server" TransformationName="cms.root.attachmentLightbox" SelectedItemTransformationName="cms.root.attachmentLightboxDetail" Path='<%# Eval("NodeAliasPath") %>' />
</div>

</div>
</div>

I used this guide for reference: http://www.kentico.com/docs/devguide/index.html?attachments_overview.htm

I am currently using unsorted attachments on the supporting feature document type. I have also tried to use the inline gallery controls in editable regions and I get the same error messages.

thanks for the help!
Jeremy

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/8/2010 5:52:34 AM
   
RE:Lightbox in Transformation
Hi,

Thank you for information. Could you please try to use following transformations:

In case of following structure:

Products (page (menuitem) document type with repeater webpart)
--Benefit 1 - your custom document type
---Support feature1 - your custom document type with attachments in Properties - Attachments
---Support feature2
--Benefit 2

In the Properties of repeater webpart (on Products page) set
Document types: Product_Benefits_code_name;
Nested controls ID: SupportingFeatureRepeater

Then you can modify the transformation following way:

<div class="bigBenefit">
<a name="<%# Eval("Title") %>"></a>
<h3>
<%# Eval("Title") %>
</h3>

<cms:CMSRepeater OrderBy="NodeOrder" ID="SupportingFeatureRepeater" runat="server" ClassNames="custom.supporting_feature" TransformationName="custom.supporting_feature.Default" Path='<%#Eval("NodeAliasPath")+"/%"%>' ></cms:CMSRepeater>
</div>



Here is the transformation from the supporting feature:

<%@ Register Src="~/CMSWebParts/Attachments/AttachmentLightBoxGallery.ascx"
TagName="AttachmentLightboxGallery" TagPrefix="cms" %>
------------------------------------
<div class="supportingFeature">
<div class="screenShots">
<div class="ScreenShotGallery">
<cms:AttachmentLightboxGallery ID="AttachmentLightboxGallery" runat="server" TransformationName="cms.root.attachmentLightbox" SelectedItemTransformationName="cms.root.attachmentLightboxDetail" Path='<%# Eval("NodeAliasPath") %>' />
</div>
</div>
</div>



This way images should be displayed below supported feature document type. I couldn't reproduce your error. The gallery was working.

In case you are still facing the issue:
1. Just to be sure: Are you using Portal Engine or ASPX templates?
2. What version (hotfix) of CMS are you using?
3. If you are using ASPX templates, could you please insert your template?
4. Where you can see the error? On the live site or in the CMS Desk?

Best regards,
Ivana Tomanickova

User avatar
Member
Member
jeremy-salespad - 10/11/2010 8:04:10 AM
   
RE:Lightbox in Transformation
Thanks again for your reply. I put in then new transformations shown above and I get the same error as before.

I am using ASPX templates with hotfix 5.5.20. I can see the error in preview on the CMS desk and on the live site.

Here is the aspx template for the product page:


<%@ Page Title="" Language="C#" MasterPageFile="~/CMSTemplates/SalesPad/SalesPad.master"
AutoEventWireup="true" CodeFile="Product.aspx.cs" Inherits="CMSTemplates_SalesPad_Product" %>


<asp:Content ID="Content1" ContentPlaceHolderID="plcMain" runat="Server">
<div id="Page" class="subPage productPage">
<div id="SubNavigation">
<cms:CMSListMenu runat="server" ID="MainNav" DisplayHighlightedItemAsLink="true"
Path="/{0}/%" HighlightAllItemsInPath="true" ClassNames="CMS.MenuItem;custom.product_group;custom.product">
</cms:CMSListMenu>
<a href="<%= ResolveUrl("~/Products/Request-A-Demo.aspx")%>" id="RequestDemo">
<img src="<%= ResolveUrl("~/images/demo_request.jpg")%>" /></a>
</div>
<div id="PageContainer">
<div id="PageHeader">
<img class="background" src="<%= ResolveUrl("~/images/salespad_headerbg.jpg")%>" />
<div class="overlay">
</div>
<div id="Breadcrumbs">
<cms:CMSBreadCrumbs ID="BreadCrumbs" runat="server" ClassNames="CMS.MenuItem;custom.support_section"
ShowCurrentItem="false" />
</div>
<%--<img class="logo" src="<%= ResolveUrl("~/getattachment/"+CMS.CMSHelper.CMSContext.CurrentDocument.DataRow["Logo"] +"/logo.aspx?maxsidesize=98") %>" />--%>
<h1>
<cms:CMSDocumentValue ID="docVal" runat="server" AttributeName="DocumentName" FormattingString="{0}" />
</h1>
</div>
<div id="PageContent">
<div class="intro">
<h2>
<cms:CMSEditableRegion runat="server" ID="Tagline" RegionType="TextBox" Width="300" />
</h2>
<cms:CMSEditableRegion runat="server" ID="MainContent" RegionType="HtmlEditor" />
<ul class="anchorlist">
<cms:CMSRepeater OrderBy="NodeOrder" ID="BenefitAnchorRepeater" runat="server" ClassNames="custom.big_benefit"
TransformationName="custom.big_benefit.Anchor">
</cms:CMSRepeater>
</ul>
</div>
<cms:CMSRepeater ID="BenefitRepeater" OrderBy="NodeOrder" runat="server" ClassNames="custom.big_benefit"
TransformationName="custom.big_benefit.Test" NestedControlsID="SupportingFeatureRepeater">
</cms:CMSRepeater>
</div>
<div id="Sidebar">
<div class="sideBox">
<div class="boxTop">
</div>
<h4>
Related Links</h4>
<ul>
<li><a href="http://kentico.salespad.net/Products/Case-Studies.aspx">Case Studies</a></li>
<li><a href="http://kentico.salespad.net/Support.aspx">Support</a></li>
<li><a href="http://kentico.salespad.net/Products/Request-A-Demo.aspx">Request a Demo</a></li>
</ul>
</div>
</div>
</div>
<div style="clear: both;">
</div>
</div>
</asp:Content>



thanks.
Jeremy

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/12/2010 6:57:09 AM
   
RE:Lightbox in Transformation
Hi,

Your aspx template seems to be correct. I was not able to reproduce the issue. Could you please show us also the code of your master template?

Could you please check if you do not have any <%= … %> blocks in the HEAD element?
Following link could be useful for you: http://stackoverflow.com/questions/778952/the-controls-collection-cannot-be-modified-because-the-control-contains-code-blo

Best regards,
Ivana Tomanickova

User avatar
Member
Member
jeremy-salespad - 10/12/2010 7:54:01 AM
   
RE:Lightbox in Transformation
You are correct. My master page had this in the <HEAD> tag:
<script type="text/javascript" src="<%= ResolveUrl("~/js/jquery-1.4.2.min.js") %>"></script>

I moved this and it resolved the issue. Thanks for all of your help!

Jeremy