+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / News Per category

News Per category

6 posts, 1 answered
  1. Siddesh Kapadi
    Siddesh Kapadi avatar
    239 posts
    Registered:
    09 Oct 2009
    08 Jul 2010
    Link to this post
    Hey,

    I have created the custom news list module by inheriting from NewsView. I try to restrict the list by selecting the category. all the records are displayed irrespective of the filter. How can I apply the filter for this?

    Please help!


    Regards,
    Siddesh Kapadi
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    08 Jul 2010
    Link to this post
    Hi Siddesh Kapadi,

    Newsview is a control, so you cannot create a module by inheriting from it. You can use FilterExpression property with the following syntax - Category  = "CategoryName" or inside your control override CreateChildControls or CrateDataSource methods and use ContentFilterBulder class

    ContentFilterBuilder filterBuilder = new ContentFilterBuilder();
     
    filterBuilder.AddFilter(new ContentFilterStatement("Category", "CategoryName", ContentFilter.Condition.In, ContentFilter.JoinType.And));


    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Siddesh Kapadi
    Siddesh Kapadi avatar
    239 posts
    Registered:
    09 Oct 2009
    08 Jul 2010
    Link to this post
    Hey,
    This is working fine. i had another filter enabled hence this did not work. commented the filter :)

    Regards,
    Siddesh Kapadi
  4. Siddesh Kapadi
    Siddesh Kapadi avatar
    239 posts
    Registered:
    09 Oct 2009
    25 Aug 2010
    Link to this post
    Hey,
    I get an error hat ContentFilterBuilder doesnot accept 0 arguments.
    Please help in this
  5. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    25 Aug 2010
    Link to this post
    Hi,

    You got to use 

    ContentFilterBuilder filterBuilder = new ContentFilterBuilder(this);

    You will use this inside your custom control which inherits from the NewsView control.

    Best,

    G
    Answered
  6. Siddesh Kapadi
    Siddesh Kapadi avatar
    239 posts
    Registered:
    09 Oct 2009
    25 Aug 2010
    Link to this post
    Hey George,
    Thanks for the response.
Register for webinar
6 posts, 1 answered