UPDATED:
Starting with version v2015 vol 2 (v15.2), this functionality is available out of the box. Simply set the MVCxGridViewColumn.SettingsHeaderFilter.Mode property to DateRangePicker to activate it. Please refer to the ASP.NET Grid View - Data Range Filter, Adaptivity and More (Coming soon in v15.2) blog post and the Date Range Header Filter demo for more information.
If you have version v15.2+ available, consider using the built-in functionality instead of the approach detailed below.
For Older Versions:
This example demonstrates how to implement date range filtering in the GridView extension.
Use the MVCxGridViewColumn.SetFilterTemplateContent method to create a custom editor and assign a delegate method to the GridViewSettings.ProcessColumnAutoFilter property to process a custom filter expression sent from the client side.
See Also:
E1990: OBSOLETE - Date Range Filtering in the Filter Row
Question Comments
Added By: Gustavo Sainz at: 11/11/2014 11:08:43 AM
I can't make it to work, as the ProcessColumnAutoFilter does not trigger when settings the grid to use
settings.CustomBindingRouteValuesCollection.Add(GridViewOperationType.Filtering, new { Controller = "ViewDate", Action = "AdvancedCustomBindingFilteringAction", key = "-1" });
Any idea how to resolve this?
Added By: Vladimir (DevExpress Support) at: 11/11/2014 10:25:08 PMHello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T171947: The ProcessColumnAutoFilter does not trigger. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
I've implemented this technique in our solution and it seems to basically work. The user's current selections are displayed in the EndCallback function via "dde.SetText". However, when the user manually clears out those values I would like the custom filtering to be removed, which is the same behavior for a "normal" field. I'd also like to allow the user to type a date range in their manually ("03/01/2015|04/01/2015") and have the same affect as though those dates were selected via the calendar popup.
How can I get that to happen? I haven't been able to figure out what event(s) should be captured. Having the user manually enter dates isn't critical, but we'd definitely like to be able to have those cleared values reset the filtering for the column.
Note that we haven't yet upgraded to v2015, so we're looking for a v2014 solution, if possible.
Added By: Artem (DevExpress Support) at: 1/22/2016 4:31:27 AMHello Don,
To process your recent post more efficiently, I created a separate ticket on your behalf: T337328: Improve date range filtering example. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
I am using dll verision v14.1 and I don't see 'SetFilterTemplateContent' in column variable.
I am coding the setting in c# not Razor and want to make this date range filter.
That is the column I am trying to add a template for
GridViewDataColumn newcolumn = settings.Columns.Add(Model.ReportParameters.SelectedCategoryProperties[i].Name); newcolumn.Settings.FilterMode = ColumnFilterMode.DisplayText;
Any idea why I don't see it ? or is there another way ?
Added By: Artem (DevExpress Support) at: 4/13/2016 1:31:49 AM
Hello Michael,
Thanks for contacting us. I've created a separate ticket on your behalf (T367211: The SetFilterTemplateContent method isn't available for GridViewDataColumn). It has been placed in our processing queue and will be answered shortly.