Bug reports Found a bug? Post it here please.
Version 4.x > Bug reports > CMSRepeater WhereCondition ignored when built via bind in markup View modes: 
User avatar
Member
Member
Erik - 5/4/2009 11:41:42 AM
   
CMSRepeater WhereCondition ignored when built via bind in markup
We're using version 4.0.3328 and ASPX templates. One section of a site we're working on features a 2-level sidebar menu which lists a few map location categories (first level) and a series of locations that belong to each (second level). The "Location" document type has a dropdown field (LocationID) which pulls its text and values from a standalone table in the database -- this is the key to this "one category to many locations" relationship.

To build the sidebar menu, we have a repeater in our ASPX page template which uses a custom query to pull the location categories from the standalone table in the database:


<h3>Regional Map</h3>
<ul>
<cms:CMSRepeater ID="cmsrptLocations" runat="server" ClassNames="custom.Location"
TransformationName="custom.Location.SidebarList">
</cms:CMSRepeater>
</ul>


The "SidebarList" transformation has a nested repeater in it which pulls in the ID of the category to list only the locations which have that category selected:


<li><%# Eval("Name") %>
<ul>
<cc1:CMSRepeater ID="cmsrptrLocations" runat="server" Path="/Locations/Sites/%"
ClassNames="custom.Location" TransformationName="custom.Location.ListItem"
WhereCondition='<%# String.Format("LocationTypeID = {0}", Eval("LocationTypeID")) %>'></cc1:CMSRepeater>
</ul>
</li>


This would seem to work fine, since the WhereCondition would end up limiting each main repeater item to displaying just the locations that belong to that category. However, with the above code we get all locations listed under each category. If I change the WhereCondition above to:

WhereCondition='LocationTypeID = 3'

Then the WhereCondition works -- but of course, we get the same set of locations under each category (the ones that have a LocationTypeID of 3).

I've tried this with a CMSRepeater and a QueryRepeater, but both have the same problem. I've also tried many different ways of setting "WhereCondition", but to no avail. It only seems to work when WhereCondition has no server-side code in it (i.e. <%# ... %> ). Bug?

Erik

User avatar
Member
Member
Erik-bertpc - 5/7/2009 11:37:37 AM
   
RE:CMSRepeater WhereCondition ignored when built via bind in markup
FYI to all - this is fixed by adding the following attribute to the nested repeater:

DelayedLoading="true"

This setting is not yet in the ASPX documentation (will be in 4.1), so you can read about it on the WebParts side. It is available in intellisense for both WebParts and ASPX control versions.

Erik

User avatar
Member
Member
darrenjhayes-gmail - 3/22/2010 6:26:56 AM
   
RE:CMSRepeater WhereCondition ignored when built via bind in markup
Thanks for the fix - I was having the same problem as the original poster.

User avatar
Member
Member
ccartee-edats - 6/29/2009 6:52:58 PM
   
RE:CMSRepeater WhereCondition ignored when built via bind in markup
CMSRepeater does it's data load on init.

you can either use delayloading

or you can reload the data in an OnItemDatabind method on cmsrptLocations