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

[Solved] Data entry issues with NewRow

1 Answer 126 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Edward
Top achievements
Rank 1
Edward asked on 23 Nov 2010, 12:42 PM
Hello,

A couple of issues to do with data entry with NewRow:

1. Suppose you have 3 columns in your grid. You add a new row by clicking on the NewRow and then fill in data for columns 1, 2 and 3, and press Tab to commit the new row. You then click on the NewRow again. The cursor appears in column 3 (because it was the most recently used column) - I would expect it to appear in column 1. Similarly, if you only fill in data for columns 1 and 2 then press Esc to abandon the NewRow, then click on the NewRow again, the cursor appears in column 2 - again I think it should appear in column 1.

2. After pressing Tab to commit the new row, I would actually like another new row to automatically be added (and the cursor placed in column 1). Then the user would press Esc if they didn't want the new row. This would speed up data entry because there is no need to use the mouse. How would I implement this?

Many thanks

Ed

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 23 Nov 2010, 04:52 PM
Hi Edward,

1. This is the behavior by design. If you want to predefine it, you may do as follows:
private void playersGrid_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
    this.playersGrid.CurrentColumn = this.playersGrid.Columns.OfType<GridViewColumn>().First();
}

2. You may try to handle the KeyDown event like:
private void playersGrid_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Tab)
            {
                var grid = sender as RadGridView;
                Player currentItem = grid.CurrentItem as Player;
                if ((currentItem != null))
                {
                    grid.BeginInsert();
                    grid.CurrentColumn = grid.Columns[0];
                }
                else
                {
                    e.Handled = true;
                }
            }
        }


 
Sincerely yours,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Edward
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or