How to enable arrow key (up and down) for Rad Grid ?

1 Answer 37 Views
GridView
Aravind
Top achievements
Rank 2
Iron
Iron
Iron
Aravind asked on 27 Jun 2024, 05:30 AM | edited on 27 Jun 2024, 05:30 AM
Hi,
     I want to enable up and down key for  rad grid to select to row and get values from that. In winform how to achieve this ?

Note:  My grid have simply row it not have sub grid or some other. Please provide sample code in vb .

Pls replace asap.

Regards
Aravind

1 Answer, 1 is accepted

Sort by
1
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 27 Jun 2024, 02:03 PM

Hello, Aravind,

The up/down arrow keys are enabled by default. Upon pressing them you should be able to change the selection. Here is how you can get the cell values when clicking on the up/down arrow keys on your keyboard:

this.radGridView1.PreviewKeyDown += RadGridView1_PreviewKeyDown;
this.radGridView1.CurrentRowChanged += RadGridView1_CurrentRowChanged;

private void RadGridView1_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e)
{
    if (updownpressed)
    {
        var value = e.CurrentRow.Cells[0].Value;     
    }
}
bool updownpressed=false;
private void RadGridView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
    if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
    {
        updownpressed = true;
    }
    else
    {
        updownpressed = false;
    }
}

I hope this helps. If you have other questions, please let me know. 

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Aravind
Top achievements
Rank 2
Iron
Iron
Iron
commented on 03 Jul 2024, 03:59 AM | edited

Thank its working.....

Regards
Aravind
Tags
GridView
Asked by
Aravind
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or