This is a migrated thread and some comments may be shown as answers.

custom filter with date ranges

3 Answers 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Judy
Top achievements
Rank 1
Judy asked on 02 Apr 2009, 03:10 PM
Hello!

I would like to seek guidance on how to best approach custom filters using date ranges with Start and End date values. On my grid, I only have one "Date" column that I would like to filter by 5 date ranges (I'm using a RadComboBox for the filter):
  • This Month
  • Last Month
  • Last 3 Months
  • Last 6 Months
  • Older than 6 Months

I can retrieve the correct dates using a RowFilter, as well as get the current filter value, but am not successful in displaying the filter results on the grid.

In my  class GridBoundColumnWithComboBoxFiltering : GridBoundColumn, this is what I have:
private void list_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            GridFilteringItem filterItem = (GridFilteringItem)((RadComboBox)o).NamingContainer;
            filterItem.FireCommandEvent("Filter", new Pair("Contains", this.UniqueName));
        }




protected override string GetCurrentFilterValueFromControl(TableCell cell)
        {
            if (((RadComboBox)cell.Controls[0]).Text == "Show All")
                return "";
            else
            {
                return ((RadComboBox)cell.Controls[0]).Text;
            }
        }

Thanks for your help!






3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 06 Apr 2009, 12:43 PM
Hi Judy,

The question set forth has been addressed in the support ticket that you have opened on the matter.
To avoid duplicate posts, we can continue our communication there.

Sincerely yours,
Yavor
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
newbie
Top achievements
Rank 1
answered on 10 May 2010, 10:48 PM
could you direct me to the solution for this issue.
I am having a similar problem.
0
Yavor
Telerik team
answered on 12 May 2010, 01:21 PM
Hi,

The following example demonstrates filtering on a date range:

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx

The "OrderDate" column implements a range filtering.
I hope this gets you started properly.

Best wishes,
Yavor
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.
Tags
Grid
Asked by
Judy
Top achievements
Rank 1
Answers by
Yavor
Telerik team
newbie
Top achievements
Rank 1
Share this question
or