ASPX templates
Version 3.x > ASPX templates > CMSRepeter - nesting and sorting? View modes: 
User avatar
Member
Member
kbonett-uniteform - 10/24/2008 7:11:55 AM
   
CMSRepeter - nesting and sorting?
I have 2 questions regarding CMSRepeater control:

Question1.

Can the repeater be nested inside another repeater?

I have a product lister page which has the following html & repeater markup:

<div id="wrapper">
<ul>

<cms:CMSRepeater ID="rptListerAll" runat="server"
ClassNames="custom.BanhamProduct"
TransformationName="custom.BanhamProduct.ListerAll" SelectedItemTransformationName="custom.BanhamProduct.Detail"
OrderBy="Price DESC"
ShowEditDeleteButtons="false"
Path="/{0}/{1}/{2}/{3}/%"
MaxRelativeLevel="1"
PagerControl-Enabled="true"
PagerControl-PageSize="12"
PagerControl-HideOnSinglePage="false"
PagerControl-BackText="Prev"
PagerControl-NextText="Next"
PagerControl-ShowPageNumbers="true"
PagerControl-ShowFirstLast="false"
PagerControl-PagerPosition="Top" >
</cms:CMSRepeater>

</ul>
</div>

The "custom.BanhamProduct.ListerAll" transformation basically creates a 4-item nested list:

<li>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
<li>item4</li>
</ul>
</li>

I now need to also repeat the <div><ul> that surround my CMSRepeater so that the rendered page contains multiple rows, each containing 4 items (but obviously not the same 4 !). The wrapper div is needed to allow extra styling and jQuery functionality.

Is this possible with Kentico repeaters?

I tried an asp:repeater with ItemHeader / ItemTemplate, etc but that did not work.

Question 2:

I have a DropDownList which sorts the CMSRepeater by price ascending/descending, but if I move to a different page, the sorting reverts back to the default specified in the repeater function.

Is there a way to re-sort the repeater and to maintain that across paging?



User avatar
Member
Member
kbonett-uniteform - 10/27/2008 4:16:23 AM
   
RE:CMSRepeter - nesting and sorting?
Sorry ... just to clarify the transformation in Q1:

The 4 items are actually 4 attributes of each individual product (eg. name, price, description):

<li id="product1">
<ul>
<li>attr 1</li>
<li>attr 2</li>
<li>attr 3</li>
<li>attr 4</li>
</ul>
</li>

So when the repeater is applied, I end up with the following markup:

<div class="wrapper">
<ul>
<li>product 1</li>
<li>product 2</li>
<li>product 3</li>
<li>product 4</li>
...
...
...
<li>product n</li>
</ul>
</div>

But I need to now repeat the outer <div class="wrapper"><ul> construct so that I can:

- limit the number of products to 4 per <div>
- apply some jQuery effects to the <div> and <li>product</li>

So what I end up with is:

<div class="wrapper">
<ul>
<li>product 1</li>
<li>product 2</li>
<li>product 3</li>
<li>product 4</li>
</ul>
</div>

<div class="wrapper">
<ul>
<li>product 5</li>
<li>product 6</li>
<li>product 7</li>
<li>product 8</li>
</ul>
</div>

<div>
...
</div>

Does this make sense?

User avatar
Member
Member
kbonett-uniteform - 10/28/2008 9:18:26 AM
   
RE:CMSRepeter - nesting and sorting?
I have resolved Q1 by using jQuery to append additional markup / css to create groups of 4 products, so no need for nested repeater.

However, I still need to resolve Q2 regarding maintaining DropDownList sorting across different pages.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 10/29/2008 9:20:35 AM
   
RE:CMSRepeter - nesting and sorting?
Hi,
From your posts it is not clear if you have used the nested repeaters - http://devnet.kentico.com/docs/controls/cmsrepeater.htm (second half of the document).

Regarding to your second question: The best way will be to use a query string parameter. After the value in the drop down is changed, it will be marked in the query string and then, when changing the page you need to read the query string parameter and sort the list according to it. I hope it makes sense.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
kbonett-uniteform - 10/30/2008 3:49:58 AM
   
RE:CMSRepeter - nesting and sorting?
Thanks Juraj.

I resolved nested repeater problem by using jQuery instead, but thanks for pointing out that devnet page.

I couldn't figure out how to pass the querystring to the paging control, so I used a session variable instead, which works.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 10/30/2008 5:30:50 AM
   
RE:CMSRepeter - nesting and sorting?
Hi,

you need to set the sorting query string in the code of the repeater. Then, you can get the value from the query string using the macro expression - http://www.kentico.com/docs/devguide/appendix_a___macro_expressions.htm.

Hope this will help.

Best Regards,
Juraj Ondrus