Dave Burke : Freelance .NET Web Developer specializing in Online Communities

CS Nuglet: Displaying content on selected pages

One of the functions of Chameleon I use a lot is the DisplayConditional control.  It's incredibly versatile.  I often search through the CS.Web application .ASPX pages for various use examples of DisplayConditional controls.  One such condition I used twice today in different contexts was the DisplayConditional used in conjunction with the CurrentSiteUrlCondition CScontrol.

Let's say we wanted to place a message on our site to appear on all weblog home pages, and ONLY on weblog home pages.  To achieve that we could add a placeholder to a .master page and test the current Site Url with the following.

 

<CSControl:PlaceHolder ID="DirectoryHomeMessage" Runat="server">
    <DisplayConditions><CSControl:CurrentSiteUrlCondition
        ID="CurrentSiteUrlCondition1" SiteUrlName="weblogs.weblogapplication"
        runat="server"  />
</DisplayConditions>
    <ContentTemplate>
    <CSControl:ResourceControl ResourceName="DirectoryHeader_AdvertiseMessage"
        runat="server" />
         <p></p>
        <CSControl:SiteUrl ResourceName="DirectoryHeader_AdvertiseHere"
        UrlName="advertisefaq" runat="server" />
    </ContentTemplate>
</CSControl:PlaceHolder>
 

 

Notice the SiteUrlName must include the SiteUrls.config location name as well as the url name. 

Comments (2) | Post RSS RSS comment feed

Posted on 9/25/2007 5:03:01 PM by Dave Burke
Categories: Community Server
Tags: no tags for this post

Related posts

Comments (2) -

9/25/2007 8:35:18 PM Permalink

Just a note -- the CurrentSiteUrlCondition control will also match location names.  For example, would be true for all URLs accessed within the "weblogs" location.

Ben Tiedt |

9/25/2007 8:38:42 PM Permalink

Sweet!  That's a great tip!  Thanks, Ben.

daveburke |


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke