I know that this has probably been answered a million times but I can't find it.
I have a radGrid that I have, say 10 rows in. I need to insert a row directly below the currently selected row. With a Windows control I simply say...
I have racked my brain to figure this out, as well as my whole teams brains and we are stumped.
I have a radGrid that I have, say 10 rows in. I need to insert a row directly below the currently selected row. With a Windows control I simply say...
GridView row = grdClipTask.SelectedRow; Clip grdRow = new Clip(); |
int currentlySelectedRow = row.RowIndex; (snip) List<Clip> gridItems = new List<Clip>(); gridItems.Insert(currentlySelectedRow, grdRow); |
I have racked my brain to figure this out, as well as my whole teams brains and we are stumped.
6 Answers, 1 is accepted
0

John
Top achievements
Rank 2
answered on 14 May 2009, 01:54 AM
"Fixed" this issue with...
private int FindRowPosition() |
{ |
int currentPosition = 0; |
int pos = 0; |
foreach ( GridViewRowInfo row in this.grdClipTask.Rows ) |
{ |
if ( row.IsSelected ) |
{ |
currentPosition = pos; |
} |
pos++; |
} |
Debug.Write( "\nCurrent Position: " + currentPosition ); |
return currentPosition; |
} |
Kind of a hack but it works.
0
Hi John,
Thank you for contacting us. Your solution seems ok but you can save some lines of code by iterating only the selected rows:
Do not hesitate to write me back if you have further questions.
All the best,
Nick
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thank you for contacting us. Your solution seems ok but you can save some lines of code by iterating only the selected rows:
foreach (GridViewRowInfo row in RadGridView1.SelectedRows) |
{ |
... |
} |
Do not hesitate to write me back if you have further questions.
All the best,
Nick
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

John
Top achievements
Rank 2
answered on 14 May 2009, 10:12 AM
Thanks for the reply but I don't see how your solution gives me back the current position of the selected row?
0
Hello John,
Thank you for writing us back. Here is the code that you need:
I have used the current row above because this is the row you most probably need. You can find more information about the current and selected rows in our online documentation.
Regards,
Nick
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thank you for writing us back. Here is the code that you need:
int index = this.rgvTest.Rows.IndexOf((GridViewDataRowInfo)this.rgvTest.CurrentRow); |
I have used the current row above because this is the row you most probably need. You can find more information about the current and selected rows in our online documentation.
Regards,
Nick
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Vladimir
Top achievements
Rank 1
answered on 04 Mar 2010, 03:01 AM
Looking for answer on the same question and those examples does not work for me.
For some reason version I have (RadControls for WPF Q3 2009 SP2) does not have classes GridViewRowInfo or GridViewDataRowInfo. Also Rows property for RadGridView gives an error "Cannot resolve symbol 'Rows'. What is wrong? Thank you.
For some reason version I have (RadControls for WPF Q3 2009 SP2) does not have classes GridViewRowInfo or GridViewDataRowInfo. Also Rows property for RadGridView gives an error "Cannot resolve symbol 'Rows'. What is wrong? Thank you.
0
Hi Vladimir ,
Thank you for contacting us. It seems that you have posted your WPF related question to our WinForms section of our forums. Please re-post it to the correct section.
Greetings,
Nick
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thank you for contacting us. It seems that you have posted your WPF related question to our WinForms section of our forums. Please re-post it to the correct section.
Greetings,
Nick
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.