Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Complicated Nested Repeater With Query View modes: 
User avatar
Member
Member
bowens-bluemodus - 11/17/2009 6:08:37 PM
   
Complicated Nested Repeater With Query
I am having trouble getting a proper Where clause on a Nested Repeater. Basically, I have a pipe delimited list (ex "1|2|3") called "AssociatedArticles" that is a property of my "Video" doc type. The list is made up of IDs of another doc type, Article. Here is some code used in my Video repeater.

<cc1:CMSRepeater ID="rptArticles" runat="server" ClassNames="SW.Article" TransformationName="SW.Article.NestedArticles" path="/%" DelayedLoading="False" WhereCondition='<%#(String.IsNullOrEmpty(Eval("AssociatedArticles").ToString()) ? "ArticleID IN (-1)" : "ArticleID IN (" + Eval("AssociatedArticles").ToString().Replace("|", ",") + ")")%>'>
</cc1:CMSRepeater >

The problem I'm having is that the where clause doesn't work. It doesn't break, but no matter what I set DelayedLoading to I cannot get it to properly filter. If I simply hardcode my where condition, for example "ArticleID in (1,16)" then it will work fine, but for some reason it seems to be stripping out the Evals or something and it ends up displaying all of the articles instead of just the ones I want. Does anyone know why this might be? If I change the WhereCondition to something that is bad formatting, then it will fail to compile and give me a syntax error, but as it is right now it compiles and loads, it just acts as if the WhereCondition is blank. I debugged a bit by just outputting what I have in the WhereCondition, and I get the string I am looking for. Any thoughts?

User avatar
Member
Member
bowens-bluemodus - 11/18/2009 3:30:50 PM
   
RE:Complicated Nested Repeater With Query
Okay, I figured out that my WhereCondition WAS working, but that for some reason the repeater ignores my path when I put DelayedLoading to True. It only looks below the object of the outer repeater.

I'm not sure how to work around this as it seems to be basically ignoring what I put for Path.

User avatar
Member
Member
luke.morton-mater.org - 11/23/2009 5:15:47 PM
   
RE:Complicated Nested Repeater With Query
I have exactly the same problem. Did you find a solution?

User avatar
Member
Member
bowens-bluemodus - 11/24/2009 11:27:23 AM
   
RE:Complicated Nested Repeater With Query
No, not yet. If you put the nested controls ID in the outer repeater's properties, it will always inherit the path and you can't change it. But if you leave the NestedControlID field blank, it should work. The bug seems to be that it ignores that path when DelayedLoading is set to True. I can't figure out a way around it. I've been in contact with Kentico support and I'll post my findings here.

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 11/30/2009 4:17:28 PM
   
RE:Complicated Nested Repeater With Query
Hi all,

Finally we've found that there's actually a bug in the current version. I'm sorry for the inconvenience.

It will be fixed in the upcoming version. For now, there is quite simple workaround:

In your transformation (directly), please put the following code-behind script:


<script runat="server">

protected override void OnLoad(EventArgs e)
{
rptArticles.DataBindByDefault = true;
base.OnLoad(e);
}

</script>


Some more comments:

- If you want to specify custom path to the repeater (control) inside your transformation, you cannot connect it with the parent repeater using it's NestedControlsIDs property, because the path will be overriden in that case.

- DelayedLoading set to true is required for any custom functions that should supply the path in order to have "enough time".

Best regards,
Zdenek C.