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

Custom Filter - only Equal To with Enter

2 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 23 Jul 2014, 08:52 AM

Hello,

I am working on a project with a RadGrid.

In the RadGrid, each column has a filter.
My project needs that when a user enters text into the filter’s textbox and presses “Enter”, an “Equal To” filter will be performed.

All filters should work as default too. When a user enters text into the filter’s textbox and chooses ANY filter, the filter will immediately be performed.
I would love to see a solution that accomplishes this.

I attached video of the 2 functionality I want:
On Enter Key Perform “Equal To”
Default RadGrid Filter Behavior 

Thanks,
Daniel.

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 23 Jul 2014, 07:25 PM
Hi Daniel,

Please try with the below code snippet.

<telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID" CurrentFilterFunction="EqualTo"
                       AutoPostBackOnFilter="true">

Please set DataField,CurrentFilterFucntion and AutoPostBackOnFilter properties in column.

Let me know if any concern.

Thanks,
Jayesh Goyani
0
Daniel
Top achievements
Rank 1
answered on 24 Jul 2014, 09:32 AM
Hello,

Thank you for the solution.

In my project the RadGrid columns and data dynamically change, so I used your solution like this: 
Private Sub RadGrid1_ColumnCreated(sender As Object, e As GridColumnCreatedEventArgs) Handles RadGrid1.ColumnCreated
        e.Column.CurrentFilterFunction = GridKnownFunction.EqualTo
        e.Column.AutoPostBackOnFilter = True
End Sub


Yet, it does not meet my project’s requirements: 
  • When the user writes a value in the Text-Box and presses Enter – “EqualTo” filter should be performed. 
  • When the user writes a value in the Text-Box and clicks on the filter button - it will open a list of filters, from which the user can choose and then immediately that filter should be performed.
  • If the user already chose a different filter than “EqualTo” from the list, and then writes a value in the Text-Box and presses “Enter” – the “EqualTo” filter will be performed, **ALTOUGH THE USER CHOSE A DIFFERENT FILTER. ENTER WILL ALWAYS PERFORM AN EQUAL-TO FILTER**.  
Thanks in advance,

Daniel.





Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Daniel
Top achievements
Rank 1
Share this question
or