Custom Filter - only Equal To with Enter

3 posts, 0 answers
  1. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 23 Jul 2014 Link to this post

    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. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 23 Jul 2014 in reply to Daniel Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 24 Jul 2014 in reply to Jayesh Goyani Link to this post

    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.





Back to Top