More in this section
Forums / Developing with Sitefinity / How do i find the selected news categorys from the newsview control

How do i find the selected news categorys from the newsview control

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Anthony Smith
    Anthony Smith avatar
    34 posts
    08 Dec 2009
    07 Jan 2010
    Link to this post
    I'm working on a custom control inheriting off the newsview control, However how do i find the selected news categorys? as i dont seem to be able to see how?

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    07 Jan 2010
    Link to this post
    Hi Anthony Smith,

    You can override SetItemMetaData method where you have access to the content items. Then call GetMetaData method with "Category" parameter. This will return a list of the selected categories or you can create a generic ICategory list and populate it.

    The following code will also return the categories that has been selected and set through NewsViewControlDesigner as a FilterExpression.

    protected override void CreateContentList()
    string filterExpression = this.FilterExpression;
    Telerik.Cms.Engine.ContentViewFiltering.ContentFilterBuilder filterBuilder = new Telerik.Cms.Engine.ContentViewFiltering.ContentFilterBuilder(this);
    string[] categories = filterBuilder.ParseCategories();

    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