General - .NET User Groups General issues with editing, development and graphic design.
Kentico CMS for .NET User Groups > General - .NET User Groups > Nested repeaters in CODE View modes: 
User avatar
Member
Member
support-schepnet - 5/13/2009 4:12:21 AM
   
Nested repeaters in CODE
Hello,

I have written a (custom) webpart that shows data from a DataSet, in this webpart there is a CMSRepeater which is linked to a Transformation.
Example:
//C#Code
CMSRepeater rep = new CMSRepeater();
rep.TransformationName = TransformationName;
rep.ItemSeparator = "<hr />";

DataSet dsData = new DataSet();
DataTable tblData = dsData.Tables.Add();
tblData.Columns.Add("Column1", typeof(string));
tblData.Columns.Add("Column2", typeof(string));
tblData.Columns.Add("Column3", typeof(string));

tblData.Rows.Add("Column1text", "Column2text", "Column3text");

rep.DataSource = dsData;
this.Controls.Add(rep);

//Transformation
1: <%# Eval("Column1") %>
<br />
2: <%# Eval("Column2") %>
<br />
3: <%# Eval("Column3") %>

Now I want to add a fourth Column which is an Array of strings, how can I show the values in a transformation?
Example:
//C#Code
tblData.Columns.Add("Column4", typeof(string[]));

//Transformation
4: <%# Eval("Column4") %>?????

I have tried using a CMSDataList but it is not working for me, can’t find an example on how to create nested repeaters in C# Code. Can you tell me how realize this?

Thanks in advance,

Remy Bakker

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 5/23/2009 4:27:24 AM
   
RE:Nested repeaters in CODE
Hi Remy,

we haven't tested this approach, but I think that Eval("Column4") returns object of type string[], so I would recommend creating custom function for transformation which you pass Eval("Column4") as parameter and then in this function you process the array and return appropriate string in the format that you want.

Best Regards,

Martin Dobsicek