Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Transformation - Eval in Repeater problem View modes: 
User avatar
Member
Member
michal.fronczyk-u2i - 3/24/2011 12:02:54 PM
   
Transformation - Eval in Repeater problem
Hi there,

I'm trying to write a custom transformation for Category List web part. For each category I want a list of items for that category. Then I'll write some JS to show/hide each category contents.

Here's my transformation:


<%# Eval("CategoryDisplayName") %><br />

<cc1:cmsdatalist WhereCondition="DocumentID IN ( SELECT DocumentID FROM CMS_DocumentCategory WHERE CategoryID = <%# Eval("CategoryID") %> )"
ID="CarriersList" runat="server" ClassNames="Savo.Career"
TransformationName="Savo.Career.Preview"
SelectedItemTransformationName="Savo.Career.Default" RepeatDirection="Vertical"
RepeatLayout="Table" RepeatColumns="1" />


I'm getting this error:

[CMSDataProperties.LoadTransformation]: The server tag is not well formed.


The problematic part is "<%# Eval("CategoryID") %>". When I change that to a constant id it doesn't show the error anymore.

Does anybody know how to pass a dynamic parameter to the CMS control?

Thanks, Michal


User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/24/2011 3:41:56 PM
   
RE:Transformation - Eval in Repeater problem
Hi,

The apostrophes and quotes are always tricky. Therefore I would like to recommend to create a custom function where you compose the where condition and then call it in the transformation like this:

WhereCondition=<%# MyFunctions.WhereCond(Eval("categoryID")) %>

Best regards,
Juraj Ondrus

User avatar
Member
Member
michal.fronczyk-u2i - 3/25/2011 4:48:08 AM
   
RE:Transformation - Eval in Repeater problem
Hi Juraj,

Thanks for your suggestion.

I haven't tried your solution because I've already solved the problem in a different way:

<cc1:cmsdatalist
WhereCondition='<%# "DocumentID IN ( SELECT DocumentID FROM CMS_DocumentCategory WHERE CategoryID = " + Eval("CategoryID") + " )" %>'
ID="CarriersList" runat="server" ClassNames="Savo.Career" TransformationName="Savo.Career.ListPreview"
SelectedItemTransformationName="Savo.Career.Default" RepeatDirection="Vertical" RepeatLayout="Flow" DelayedLoading="true"/>


I changed my WhereCondition slightly and I had to add DelayedLoading="true". That seems to work fine.

Thanks,
Michal