This question is locked. New answers and comments are not allowed.
Hello,
Is there a way to allow insertion of a new row between existing grid rows? Our customer is used to Excel, where (of course) you can right-click on any row and select Insert Row.
Thanks a lot
Ed
Is there a way to allow insertion of a new row between existing grid rows? Our customer is used to Excel, where (of course) you can right-click on any row and select Insert Row.
Thanks a lot
Ed
6 Answers, 1 is accepted
0
Hello,
Vlad
the Telerik team
You can use Insert() method for the collection bound to the grid and the grid will be updated properly after such collection changed event.
Greetings,Vlad
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
0
Edward
Top achievements
Rank 1
answered on 17 Nov 2010, 01:19 PM
Thank you. So I guess a complete solution would be to set up a context menu on the grid containing an Insert Row item, which when selected detects which row was clicked on and inserts into the underlying collection at the appropriate position. Does that sound a fairly straightforward job?
Ed
Ed
0
Hello,
Vlad
the Telerik team
Indeed this will work in your case. You can check this demo for more info about the row context menu.
Regards,Vlad
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
0
Edward
Top achievements
Rank 1
answered on 22 Nov 2010, 11:44 AM
I've implemented Insert Row as follows:
This works, except that while the new row is correctly selected, the currently-selected cell does not change (it is still on the previous row). How can I programmatically move the selected cell up one row?
Thanks very much
Ed
// Create new row for the grid, in a generic way (so that this code can be used in any grid)object newRow = gridView.Items.AddNew();// The new row is now at the bottom of the grid, so immediately remove itgridView.Items.Remove(newRow);// Insert the row at the current position// gridView.Items.Insert throws an exception at this point, so insert directly into the underlying collectionint currentIndex = gridView.Items.IndexOf(row);((IList)gridView.ItemsSource).Insert(currentIndex, newRow);// Select the new rowgridView.SelectedItem = newRow;gridView.Items.MoveCurrentTo(newRow);This works, except that while the new row is correctly selected, the currently-selected cell does not change (it is still on the previous row). How can I programmatically move the selected cell up one row?
Thanks very much
Ed
0
Mahmut
Top achievements
Rank 2
answered on 23 Nov 2010, 09:56 PM
Hello,
i think you can try this (instead of MoveCurrentTo):
gridView.CurrentItem = gridView.SelectedItem;
mahmut0
Edward
Top achievements
Rank 1
answered on 24 Nov 2010, 11:43 AM
Nearly :) The inserted row is selected and the current row indicator points at the new row, but the selected cell border disappears. No matter - this will do us just fine!
Thanks very much to Telerik for all their fast and useful help on these forums.
Ed
Thanks very much to Telerik for all their fast and useful help on these forums.
Ed
