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

Keyboard handling bug with "Click here to add new item"

1 Answer 13 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 18 Dec 2013, 09:25 PM
Scenario:  I have a RadGridView with "Click here to add new item" enabled.

If I click on a row and then hit 'Enter', the selection navigates to the next row as expected.

If I click on "Click here to add new item" then a new row is created and focus is given to the first cell, as expected.  If I enter some data and press 'Enter' the data is committed but then it appears that the keyboard event is passed along to the parent control.  In my case, it dismisses the dialog.



1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 23 Dec 2013, 01:00 PM
Hi Chris,

The thing is that the newly added item can move to different position depending on the state of the grid - whether it is sorted, grouped, paged, etc. and the process of adding the item in the collection and moving it in the correct place breaks the consequence of commands executed on pressing Enter key.
What you can try is to handle RowEditEnded event and perform the logic you want there. For example:
private void clubsGrid_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
        {
            if (e.EditOperationType == Telerik.Windows.Controls.GridView.GridViewEditOperationType.Insert)
            {
                this.clubsGrid.SelectedItem = e.EditedItem;
            }
        }

Will that approach meet your requirements ?

Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or