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

The cell of row of Grid view index go to next cell

1 Answer 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ayman
Top achievements
Rank 1
Ayman asked on 18 Jun 2013, 03:52 PM
hello

I'm using this code to get the focus on the new row, first cell after inserting a row

private void myGrid_UserAddingRow(object sender, GridViewRowCancelEventArgs e)
{  
    myGrid.CurrentRow.Cells[0].BeginEdit();
}


but the focus goes to second cell of the new row 

what is the problem

thanks

1 Answer, 1 is accepted

Sort by
0
George
Telerik team
answered on 21 Jun 2013, 06:54 AM
Hello Ayman,

I am glad you contacted us.

To select the last added row and edit it, first you need to subscribe to the UserAddedRow event, which will trigger after the row has already been added to the collection of rows, which on the other hand will allow us to easily access the last element in that collection. Please see the code below:
private void radGridView1_UserAddedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e)
        {
            int lastRowPosition = this.radGridView1.ChildRows.Count - 1;
            this.radGridView1.Rows[lastRowPosition].Cells[0].BeginEdit();
        }

I hope this helps.

Off topic, you have posted the same thread in the ChartView section. Due to duplicity the other thread is deleted.

Regards,
George
Telerik
RadChart for WinForms is obsolete. Now what?
Tags
GridView
Asked by
Ayman
Top achievements
Rank 1
Answers by
George
Telerik team
Share this question
or