More in this section

Forums / Developing with Sitefinity / Getting Event Filters in Code

Getting Event Filters in Code

2 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    03 Dec 2008
    06 Jul 2011
    Link to this post
    If we do /yyyy/MM/dd in the URL to filter down the event widget, how do I grab the current filter in the code behind?

    I really just need to know a filter exists so I can show an element (back link)

    I need to show something when there are no events on that date...I tried the empty containers, but it didnt seem to do anything.

        No Events Today
        No Events
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    06 Jul 2011
    Link to this post
    Hi Steve,

    You need to get an instance of the control on your page. Then you can call MasterViewDefinition.FilterExpression. This will get the filter that is set as a property of the control. Another option is overriding InitializeControls method MasterView that your widget uses and there check whether the dynamic filter expression returns results.
    The third option is getting the date query from the url evaluator

    var query = this.Manager.GetEvents();
    query = this.EvaluateUrl(query, "Date", this.Host.DateEvaluatorPropertyName, this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix);

    and use

    DataProviderBase.SetExpressions to see if there will be items returned by your control.

    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered