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

Identify row index from GridViewCellEditEndedEventArgs

5 Answers 53 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Atin
Top achievements
Rank 1
Atin asked on 29 Oct 2012, 11:24 AM
Hi All,

I am trying to identify Row index and Cell index from GridviewCellEditEnded Event args. Is it possible? Is it possible to identify it from Cell begin edit event?


Thanks in advance.
Atin

5 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 29 Oct 2012, 12:53 PM
Hi Atin,

Generally it is not recommended to work with the visual elements. Since the RadGridView supports UI Virtualization, its cells are reused on scrolling and that is why we cannot rely on them. I would advise you to work with the bound data item instead. May I ask you to share more details on why do you need this information. What is your final goal?

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Atin
Top achievements
Rank 1
answered on 30 Oct 2012, 04:04 AM
Hi Didie,

Thanks for the reply.

I want to control the tab navigation in the Rad gridview. Is it possible for me to change which cell should be selected for editing when row selection is changed. The default behavior of the gird is such that if i am editing 3rd cell in 3rd row and then i change the row selection to 2nd row and press tab, then 4h cell of the grid becomes editable instead of the 1st cell in 2 row. I want this behavior. Is it possible.


Regards
Atin
0
Dimitrina
Telerik team
answered on 30 Oct 2012, 10:14 AM
Hi,

 You could set the CurrentColumn to be the first one once RowEditEnded event is raised. That way the first cell will go into edit mode.

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Atin
Top achievements
Rank 1
answered on 30 Oct 2012, 11:33 AM
Hi,


Is there a way to identify row index in that event?


Regards
Atin Grover
0
Dimitrina
Telerik team
answered on 30 Oct 2012, 12:39 PM
Hi Atin,

You could get the row index like so:

private void GridView1_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
{
      RadGridView myGrid = sender as RadGridView;
      var index = myGrid.Items.IndexOf(e.EditedItem);
}

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

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