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

Forums / Developing with Sitefinity / Event Selection

Event Selection

5 posts, 0 answered
  1. Neil
    Neil avatar
    30 posts
    Registered:
    20 Jan 2009
    31 Jan 2011
    Link to this post
    Hi all, I'm looking to do a search for all events that are within a given date range and in a specific category. I've got the category part of the search working fine, but am having issues with adding the date range. If somebody wouldn't mind posting a snippet showing how to create the metasearchinfo filter that would be much appreciated. Currently I've got:

    filter.Add(New MetaSearchInfo(MetaValueTypes.ShortText, "Category", _manager.Content.GetCategory(_eventCategoryId).CategoryName))
             
              _list = _manager.Content.GetContent(filter.ToArray)

    Thanks in advance!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    31 Jan 2011
    Link to this post
    Hi Neil,

    You have to create two filters

    - one for Publication_Date
    - one for Expiration_Date

    Then call GetContent(filter.ToArray()) method of ContentManager class.

    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. Neil
    Neil avatar
    30 posts
    Registered:
    20 Jan 2009
    31 Jan 2011
    Link to this post
    Thanks Ivan. Looking at the constructor for metasearchinfo there is one with parameters for condition and join type, would you mind just posting a quick example with that so  I can see what it would look like with publication_date equal to jan 1 2001? For some reason in my visual studio I cannot get the intellisense to prompt me for the condition operators (which is where I assume the equals should be going??)
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Feb 2011
    Link to this post
    Hello Neil,

    Here is a sample

    List<IMetaSearchInfo> newFilter = new List<IMetaSearchInfo>(filter);
    MetaSearchInfo searchInfo = new MetaSearchInfo(MetaValueTypes.DateTime, "Publication_Date", DateTime.Now, SearchCondition.LessOrEqual);
    MetaSearchInfo searchInfo1 = new MetaSearchInfo(MetaValueTypes.DateTime, "Expiration_Date", DateTime.Now, SearchCondition.GreaterOrEqual);
    newFilter.Add(searchInfo);
    newFilter.Add(searchInfo1);
    filter = newFilter.ToArray();


    Kind regards,
    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
  5. Neil
    Neil avatar
    30 posts
    Registered:
    20 Jan 2009
    08 Feb 2011
    Link to this post
    Thanks Ivan. I'm searching now based on the event date being a specific day, and checking whether the publication date is past or equal to the current day. 

    Edit: autopostback had been turned off, which is why the defaultviewchanged event was not being raised.
Register for webinar
5 posts, 0 answered