We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Select first row after getting focus

Thread ID:





141653 Dec 24,2018 08:36 PM UTC Dec 26,2018 11:44 AM UTC WinForms 2
Tags: SfDataGrid
Gerrit Snel
Asked On December 24, 2018 08:36 PM UTC


I try to use sfDataGrid as a search windows. I have a simple form with a TextBoxExt and a sfDataGrid.
When typing a value in the TextBox, the grid is filtered by that text.

When one row is left, I want only press enter to select the first value of the row and send it back as my key.
Or when there are multiple rows left, I want to press the down arroy (or tab) to left the TextBox and enter the sfDataGrid.
So I can use the down arrow to go to the record I want, press enter and send the first value back as my key.

It is working now with the mouse. After filtering, I can double click on a row and send back the first value of the row.

And what is working also is after filtering, I click with the mouse on a row, then go with arrow key to the record of my choose, press enter.

What I can not getting work is give the sfDataGrid the same focus as clicking with the mouse on the grid.

With sfDataGrid.Focus() and sfDataGrid1.SelectRows(1,1) or sfDataGrid.SelectCells(record, column), I can not use arrow keys to go to the other records.

So my question is:
How can I set the same focus programmaticaly as clicking with the mouse on a cell.

Thank You,


Gerrit Snel
Replied On December 25, 2018 09:50 AM UTC

Solved it:

            if(e.KeyCode == Keys.Down)
                if(sfDataGrid1.View.Records.Count > 0)

Jayaleshwari N [Syncfusion]
Replied On December 26, 2018 11:44 AM UTC

Hi Gerrit, 
Thanks for the update. 
Please get in touch if you would require further assistance. 
Jayaleshwari N. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon