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

GridView Editable Rows with new Row Addition

1 Answer 40 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sakthi
Top achievements
Rank 1
Sakthi asked on 25 Oct 2012, 03:17 AM
Hi All,

I want create the RadGridView Control with Editable Rows. Once i Edit the GridView's last row then pressing enter should add the new row and focus should be in the First column. Can you guide me on this? Also if there is any sample please share with me...

Thansk and Regards,
Sakthi 

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 26 Oct 2012, 02:12 PM
Hello Sakthi,

You could achieve your goal when the RowEditEnded event is raised. To do so, the code would be similar to this one: 

private void clubsGrid_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
{
            RadGridView grid = sender as RadGridView;
            var indexOfItem = grid.Items.IndexOf(e.Row.Item);
 
            if (indexOfItem == (grid.Items.Count - 1))
            {
                grid.BeginInsert();
                grid.CurrentColumn = grid.Columns[0];
            }
}

Please note that you will need to change the current column to be the first one, if you wish to have the focus in the First column.

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Sakthi
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or