Try Now
More in this section

Forums / Deployment / return Events by Category

return Events by Category

2 posts, 0 answered
  1. Chris Wilper
    Chris Wilper avatar
    13 posts
    01 Sep 2009
    31 Dec 2009
    Link to this post
    I have the following code to return events

     IList listOfAllEvents;

     var eventsManager = new Telerik.Events.EventsManager("Events");
     listOfAllEvents = eventsManager.GetEvents(fromDate, toDate, "[Start] ASC", franchiseQueryString);

    This works fine if I need to return events based on a date range and a tag.  I need to also filter on category, but I can't find a way to do that.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    19 Oct 2016
    03 Jan 2010
    Link to this post
    Hello Chris Wilper,

    There are two options here

    1. You can use ContentFilterBuilder class as the sample below illustrates.

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

    2. You can use MetaSearchInfo filter.

    Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager();
    List<Telerik.Cms.Engine.IMetaSearchInfo> filter = new List<Telerik.Cms.Engine.IMetaSearchInfo>();
    filter.Add(new Telerik.Cms.Engine.MetaSearchInfo(Telerik.Cms.Engine.MetaValueTypes.ShortText, "Category", "Name_of_Category"));
    // get content items filtered by specified filters
    IList listOfContentItems = contentManager.GetContent(filter.ToArray());
    if (listOfContentItems.Count > 0)
       foreach (Telerik.Cms.Engine.IContent contentItem in listOfContentItems)
           Response.Write("<br />" + contentItem.GetMetaData("Name") + "<br />");

    Kind regards,
    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