Getting Event Filters in Code

Posted by Community Admin on 04-Aug-2018 04:55

Getting Event Filters in Code

All Replies

Posted by Community Admin on 06-Jul-2011 00:00

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>

Posted by Community Admin on 06-Jul-2011 00:00

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

This thread is closed