Try Now
More in this section

Forums / Developing with Sitefinity / FilterExpression property

FilterExpression property

2 posts, 0 answered
  1. David van Geel
    David van Geel avatar
    59 posts
    19 Aug 2009
    16 Dec 2009
    Link to this post
    Hi All,

    I have defined a page with to public view controls on it. Both these controls display data from the same module (the news module). The first control is used with it's BehaviourMode property set to detail. This control is used to display the details of a news item. The second control is used with it's BehaviourMode property set to master and displays a list of news items in a specific catageory.

    I would like to excluded the current item (the item displayed in the first control) from the list displayed in the second control. I tried to get this to work by setting the FilterExpression property of the second control to

    Category = "Patiënten" AND ID = {CntID}

    As a fact anything using the ID variable seems to be disregarded. Is this the correct approach? Any pointers would be appreciated.


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    16 Dec 2009
    Link to this post
    Hi David van Geel,

    You can append the clicked item ID (from the list) as a QueryString. The control that is set in DetailsView will show this item after post back, so you will be able to hide the item from the control set in master mode. You can create a custom class that inherits from NewsView and override CreateContentList(). Inside CreateContentList() you have to subscribe for the Repeater ItemDataBound event, get the content item by reading the key in the QueryString and hide it.


    private void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                    IContent contentItem = (IContent)e.Item.DataItem;
                                    // get the Id from the Query string
                                    Guid selectedItemID = new Guid("C733D868-77C6-4bb7-BCCD-57E9A3276200)
                                     // compare the contentItemID and selectedItemID

    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered