Show all except x

rated by 0 users
This post has 5 Replies | 2 Followers

Not Ranked
Posts 5
Points 70
technovangelist Posted: Tue, Jul 24 2007 8:54 AM

 I want to create a gallery page that lists all galleries except a few specific ones. I can't seem to figure out a QueryOverides or DisplayConditions argument that gets me what I want. I don't want to include which galleries I want to display because there could be many. But I always know that there is a single gallery, or maybe 2 that I don't want to show.

Matt Williams Technovangelist
Top 10 Contributor
Posts 3,424
Points 65,610
CS Developers

If you can, I would suggest placing the galleries you don't want to render into a different group and filter by GroupID using <QueryOverrides />. 

If this isn't possible, you can not render one or more of the galleries by wrapping all of the UI in a <CSControl:PlaceHolder /> control with <DisplayConditions />, such as:

<CSGallery:GalleryList runat="server">
  <ItemTemplate>
    <CSControl:PlaceHolder runat="server">
      <DisplayConditions Operator="Not">
         <CSGallery:GalleryPropertyValueComparison runat="server" ComparisonProperty="ApplicationKey" Operator="EqualTo" ComparisonValue="[GALLERY_APPLICATION_KEY]" />
      </DisplayConditions>
      <ContentTemplate>
        [MARKUP/CONTROLS_TO_RENDER]
      </ContentTemplate>
    </CSControl:PlaceHolder>
  </ItemTemplate>
</CSGallery:GalleryList>

in this example, you could add more than one <CSGallery:GalleryPropertyValueComparision /> control within the <DisplayConditions> of the <CSControl:PlaceHolder /> control to define additional galleries to *exclude*.

Ben Tiedt's Blog

  • | Post Points: 20
Not Ranked
Posts 5
Points 70

 OK, i can use a different group, but how can I exclude just one group? I don't want to have to include each group that I want, but rather exclude one and allow everything else to show.

Matt Williams Technovangelist
  • | Post Points: 20
Not Ranked
Posts 5
Points 70

 i gave up on filtering the group in the QueryOverrides and did a variation of the other way you suggested. Here is the full code. This is teh GroupList.aspx page from the basic theme. The only difference is in the ItemTemplate block. I added a CSControl:ConditionalContent block with ContentConditions. I check to see if the Gallery Group Name is SystemImages. If the result is false, then I display the image. I don't do anything on a true. For some reason I was having a hard time understanding how to use conditional content. Realizing that I needed to define the Operator was the key.

 

   <CSGallery:GalleryList runat="server">
        <QueryOverrides SortBy="LastPost" SortOrder="Descending" PageSize="6" />       
        <HeaderTemplate>
            <ul class="CommonList">
        </HeaderTemplate>
       
        <ItemTemplate>
            <CSControl:ConditionalContent runat=server>
                <ContentConditions runat=server>
                    <CSGallery:GroupPropertyValueComparison Operator=equalto ComparisonProperty="Name" ComparisonValue="SystemImages" runat=server />
                   
                </ContentConditions>
            <FalseContentTemplate> 
            <li>
           
                <CSGallery:GalleryData runat="server" Property="Name" LinkTo="ViewGallery" Tag="H3" CssClass="CommonHeader">
                    <TrailerTemplate>
                        <CSControl:PlaceHolder runat="server">
                            <DisplayConditions Operator="And" runat=server>
                                <CSGallery:GalleryPropertyValueComparison ComparisonProperty="MostRecentPostID" Operator="GreaterThan" ComparisonValue="0" runat="server" />
                               
                            </DisplayConditions>
                           
                            <ContentTemplate>
                           
                                <span class="CommonHeaderDetails">(
                                    <CSControl:ResourceControl ID="ResourceControl2" ResourceName="Gallery_AggregateUpdatedGalleriesListing_UploadedOn" runat="Server" />
                                    <CSGallery:GalleryData ID="GalleryData1" runat="server" Property="MostRecentPostDate" />
                                )</span>
                            </ContentTemplate>
                        </CSControl:PlaceHolder>
                    </TrailerTemplate>
                </CSGallery:GalleryData>
                <div class="CommonContent">
                    <CSGallery:GalleryPostList runat="server">
                        <QueryOverrides SortBy="PictureDate" SortOrder="Descending" PageSize="5" runat="server" />
                       
                        <HeaderTemplate>
                            <ul class="GalleryImageList">
                        </HeaderTemplate>
                        <ItemTemplate>
                            <li><CSGallery:GalleryPostData LinkTo="ViewPicture" runat="server" Tag="Div" CssClass="GalleryGalleryImage"><ContentTemplate><CSGallery:GalleryPostImage runat="Server" ImageType="Thumbnail" /></ContentTemplate></CSGallery:GalleryPostData></li>
                        </ItemTemplate>
                        <FooterTemplate>
                            </ul>
                        </FooterTemplate>
                    </CSGallery:GalleryPostList>
                    <div style="clear: both;"></div>
                </div>
            </li>
            </FalseContentTemplate>
        </CSControl:ConditionalContent>
           
        </ItemTemplate>
        <FooterTemplate>
            </ul>
        </FooterTemplate>
    </CSGallery:GalleryList>
 

Matt Williams Technovangelist
  • | Post Points: 20
Top 10 Contributor
Posts 3,424
Points 65,610
CS Developers

technovangelist:

 OK, i can use a different group, but how can I exclude just one group? I don't want to have to include each group that I want, but rather exclude one and allow everything else to show.

Groups are filtered similarly to Sections -- so there is no "exclude" option.  If all of the blogs that you wanted to show were in a single group, then filtering by group would have been a good option.  If you still need to "exclude" something, you'll need to use <DisplayConditions> or custom code.

Ben Tiedt's Blog

  • | Post Points: 5
Top 10 Contributor
Posts 3,424
Points 65,610
CS Developers

technovangelist:
I added a CSControl:ConditionalContent block with ContentConditions

Because you're not using the <TrueTemplate />, you could also just use a <CSControl:PlaceHolder /> control with <DisplayConditions /> to accomplish the same effect (as in my example).

Ben Tiedt's Blog

  • | Post Points: 5
Page 1 of 1 (6 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com