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

enable filtering grid for searching when shortcut pressed.

1 Answer 53 Views
GridView
This is a migrated thread and some comments may be shown as answers.
TheMFMLive
Top achievements
Rank 1
TheMFMLive asked on 18 Feb 2017, 04:19 PM

dear all, i m facing the following issue when i pressed shortcut key which is "Ctrl + F" register in my application using the following code.

[code]

this.grdMain.GridViewElement.Shortcuts.Add(new RadShortcut(Keys.Control, Keys.F));
this.grdMain.GridBehavior = new ModifiedGridActions();

[/code]

and overriding the keyprocess function in grid behaviors using the following code

[code]

public class ModifiedGridActions : BaseGridBehavior
        {
            public override bool ProcessKey(KeyEventArgs keys)
            {
                try
                {
                    if (keys.Control && keys.KeyCode == Keys.F) // issue on this line
                    {
                        this.GridControl.MasterView.TableFilteringRow.Cells["cName"].BeginEdit();
                    }
                }
                catch (Exception ex)
                {
                }
                return base.ProcessKey(keys);
            }
        }

[/code]

when i press ctrl + f above override function triggers but its parameter only contains keys.control is true and keys.keycode property contains 17 which also ctrl code. what i expect is to get keys.control is true and keys.keycode should contains keys.F so that my logic can execute am i implementing somthing wrong.

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 20 Feb 2017, 07:44 AM
Hello,

You can override the ProcessKeyDown method instead: 
public class ModifiedGridActions : BaseGridBehavior
{
    public override bool ProcessKeyDown(KeyEventArgs keys)
    {
        if (keys.Control && keys.KeyCode == Keys.F)
        {
            this.GridControl.MasterView.TableFilteringRow.Cells["Name"].BeginEdit();
            return true;
        }
        return base.ProcessKeyDown(keys);
    }
      
}

In addition, you should remove the shortcut.

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
TheMFMLive
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or