1-888-365-2779
+1-888-365-2779
Try Now
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
    Registered:
    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)

    Also,
    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.

    <EmptyDataTemplate>
        No Events Today
        </EmptyDataTemplate>
    <EmptyItemTemplate>
        No Events
        </EmptyItemTemplate>
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 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.


    Greetings,
    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