Nested Repeater

Erick Hernandez asked on March 14, 2014 12:45

Hi

So the previous developer on that worked here tried to nest repeaters within repeaters. He tried to make the web page work and look similarly to our file tree but they aren't matching and i think there's something wrong with the transformation logic any advice?

I think this is the transformation code.


<h5 class="documentSubHeader ready" data-id="<%# Regex.Replace(EvalText("Category").Trim() +"_"+ EvalText("Name").Trim(), " |&|amp;", "_").ToLower() %>" id="<%# EvalText("Name").Trim().ToLower() %>"><%# Eval("Name") %>

<div class="subCatContainer" id="<%# Regex.Replace(EvalText("Category").Trim() +" "+ EvalText("Name").Trim(), " |&|amp;", "_").ToLower() %>">

<cms:CMSRepeater ID="qrSubDocs" runat="server" DelayedLoading="true" ClassNames="CMS.File" DataBindByDefault="false" OrderBy="FileName ASC" TransformationName="CMS.File.DocumentList" />


Image of problem

Image Text

Recent Answers


Brenden Kehren answered on March 15, 2014 11:29

Not seeing the error with the image, what's the exact error you receive?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on March 17, 2014 03:16

Hi,
Also, what are the parent repeater settings?

Just FYI, nested controls documentation and, you may also consider using hierarchical transformations.

Best regards,
Juraj Ondrus

1 votesVote for this answer Mark as a Correct answer

Erick Hernandez answered on March 17, 2014 10:23

Well the problem is that some directories are repeating (or duplicating) and going up a directory and im trying to figure how to keep them nested in their appropriate directories.

This is the repeaters properties


Path: /Documents/% Maximum nesting level: 1 Nested controls ID: mySubCat;myFiles The rest is default settings

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 18, 2014 06:36

You need to set the path on the nested repeater as well. You can see some discussion on how to set this in this old forum post. Essentially this is the code you need to set for your nested repeater in the transformation of your main item.

<script runat="server">
  protected override void OnInit(EventArgs e) 
  {
      nestedRPT.Path = Eval("NodeAliasPath") + "/%"; /
      nestedRPT.ReloadData(true);
  }
</script>
0 votesVote for this answer Mark as a Correct answer

Erick Hernandez answered on March 18, 2014 11:06

We have something similar here's the code

0 votesVote for this answer Mark as a Correct answer

Erick Hernandez answered on March 18, 2014 11:07 (last edited on March 18, 2014 11:07)

 <script runat="server">
protected override void OnInit(EventArgs e)
  {
    base.OnInit(e);
    mySubCat.Path="'"+ Eval("NodeAliasPath") +"'";
    mySubCat.ReloadData(true);
  }

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 21, 2014 06:34

This mySubCat.Path="'"+ Eval("NodeAliasPath") +"'"; will get you the rendered documents URL wrapped in single quotes. Remove the single quotes. If you need to get everything below the current document then you need this string /Node1/Node2/% returned to the Path property, not '/Node1/Node2' which is what you're string will return which is essentially a single document.

Adding the % at the end, is a wildcard search parameter. If you look in the database you'll see how things are stored and have a better understanding of why things are like they are.

The structure like so is stored like so:
-Root (/)
--Home (/Home)
--About Us (/About-Us)
---Contact Us (/About-Us/Contact-Us)
----Contact Form (/About-Us/Contact-Us/Contact-Form)

So if you want everything below the /About-Us node you need to enter /About-Us/% which will return the last 2 records. Then if you only want to go 1 level deep and not return the form, you enter the maximum level = 1.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.