Portal Engine
Version 2.x > Portal Engine > Dynamic Repeater View modes: 
User avatar
Member
Member
boodapotamus - 9/10/2007 4:51:17 AM
   
Dynamic Repeater
I am trying to use a repeater transformation to dynamically assign a WHERECondition for another repeater that pulls data from a different document node with what will eventually be thousands of listings. I could do it all by manually, but I would end up with several hundred page templates because I would have to change the where conditions on each template. Is there an easier way to accomplish this?

This is the current transfromation I am using and the setup is working. What I would like to do is be able to get the RegionName inserted into the WHEREcondition so the final outcome would be WHERECondition="State='%RegionName%'". Is this possible?

<%# Eval("RegionName") %><br />
<cc1:cmsrepeater ID="SurfReportRepeater2" runat="server" ClassNames="custom.ContestListing" TransformationName="custom.ContestListing.preview" Path="/contest-listings/%" WHERECondition="State='Florida'"></cc1:cmsrepeater>

User avatar
Member
Member
stevem@boodapotamus.com - 9/10/2007 5:00:45 AM
   
RE:Dynamic Repeater
Sorry, long day.

Eval(RegionName)

cc1:cmsrepeater
ID=ContestRegionRepeater
runat=server
ClassNames=custom.ContestListing
TransformationName=custom.ContestListing.preview
Path=/contest-listings/%
WHERECondition=State='Florida'
cc1:cmsrepeater

User avatar
Member
Member
kentico_vitaja - 9/10/2007 4:24:58 PM
   
RE:Dynamic Repeater
Hi,

recommended way to achieve what you are requesting is via "Code" tab. There you can write any modifications to your repeater you want.
Please notice also, that you should call afterwards <repeater>.ReloadData(true); to apply changes.

Best regards,
Vita Janecek

User avatar
Member
Member
boodapotamus - 9/12/2007 10:05:06 PM
   
RE:Dynamic Repeater
OK, I'm still having a little trouble with this and I thought this was going to be the easy part of the project.

I have been using this page as a reference.
http://www.kentico.com/docs/devguide/index.html?adding_custom_code_to_web_part.htm

When I try to call the reference the repeater in the transformation, it tells me the item can not be found.

Can I only modify the repeater the current repeater with the code tab, or should I be able to modify the repeater in the transformation.

This is my code in the code tab

script runat=server
public override void OnContentLoaded()
{
ContestRegionRepeater.SetValue(WHERECondition, State LIKE '%RegionName%');
base.OnContentLoaded();
}
/script

Should I not have a WHERE condition in the repeater in the transformation?

I could change it manualy on each repeater code tab, but then again, I would be looking at hundreds of page templates since the code tab is inherit of the page template.

Sorry, I'm obviously not a programmer, but I am learning slowly and this will be my 4th project with your product.

User avatar
Member
Member
kentico_vitaja - 9/18/2007 2:56:16 PM
   
RE:Dynamic Repeater
Hi,
regarding your issue with repeaters - here is advice how to make it work:

Let's say that you have two repeaters. First repeater will have in its transformation code similar to code below. Purpose of this code is to connect first and second repeater so that it can dynamically display requested data.

<cc1:CMSRepeater runat="server" ID="repeaterShowAttendees" QueryName="CMS.Meetings.SelectAllAttendees" TransformationName="CMS.Meetings.ShowMeetingsAttendees" />

<script runat="server">

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);

if (base.DataItem is System.Data.DataRowView)
{
this.repeaterShowAttendees.WhereCondition = "MeetingID = " + ((System.Data.DataRowView)base.DataItem).Row["MeetingID"].ToString();
/* the first MeetingID should be the name of meeting ID field in first table, the second MeetingID should be the name of ID field of second table */
}
this.repeaterShowAttendees.ReloadData(true);
}

</script>

As you can see in this example - in WhereCondition there are two repeaters connected via comparing MeetingID property. For more information please see: http://www.kentico.com/docs/webpartsandcontrols/cmsrepeater.htm Please notice that there should be also NestedDataListID property filled in to make sure that nested repeater will be working alright.

If you will have any more questions on this issue, please contact us at support@kentico.com, so that we can provide you better assistance.

Best regards,
Vita Janecek