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

custom filter for each column

2 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Khanh
Top achievements
Rank 1
Khanh asked on 17 May 2010, 04:48 PM
Hi all,

I am confuse when reading ms-help://telerik.aspnetajax.radcontrols.2010.Q1/telerik.aspnetajax.radgrid.2010.Q1/custom-option-for-filtering.html help file.

I have 3 columns (name=text,startdate=datetime,enddate=datetime).  The name column is set to VaryByDataType. On the startdate, I want the filter item nofilter, equalto and greaterthanorequalto.  For the enddate, I would like nofilter, equalto and lessthanorequalto.

I can't seem to get it right without affecting the other columns.
Protected Sub RadGrid1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.Init         
        Dim menu As GridFilterMenu = RadGrid1.FilterMenu 
        Dim i As Integer = Menu.Items.Count - 1 
        While i >= 0 
            If menu.Items(i).Text = "NoFilter" Or menu.Items(i).Text = "Contains" Or menu.Items(i).Text = "GreaterThanOrEqualTo" Then 
                'menu.Items.RemoveAt(i) 
            ElseIf menu.Items(i).Text = "Custom" Then 
                menu.Items(i).Text = "LessThanOrEqualTo" 
            Else 
                menu.Items.RemoveAt(i) 
            End If 
            System.Math.Max(System.Threading.Interlocked.Decrement(i), i + 1) 
        End While 
 
    End Sub 


Thanks,
Khanh

2 Answers, 1 is accepted

Sort by
0
Accepted
Martin
Telerik team
answered on 19 May 2010, 12:43 PM
Hello Khanh,

I have created a small sample project demonstrating the desired functionality. Please give it a try and let me know how it goes.

Additionally I would suggest that you review the following help article:

Reducing the filter menu options

I hope this helps

Regards,
Martin
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.
0
Khanh
Top achievements
Rank 1
answered on 19 May 2010, 12:56 PM
Thanks, Martin.  That was exactly what I needed.  Also, thanks for taking the time to create a sample project.

Khanh
Tags
Grid
Asked by
Khanh
Top achievements
Rank 1
Answers by
Martin
Telerik team
Khanh
Top achievements
Rank 1
Share this question
or