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

Inserting row at any specified position

3 Answers 73 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
Ramyashree
Top achievements
Rank 1
Ramyashree asked on 16 Feb 2011, 01:21 PM
Hi ,

  I'm having a gridview which is bound using domaindatasource... I can add new rows to the grid at it's end with minimal code (courtesy :raddomaindatasource).. However I want to be able to insert the row at any specified location as well... Any help regarding this will be appreciated...

Thanks in Advance,
Ramya

3 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 22 Feb 2011, 09:15 AM
Hi Ramyashree,

You can add a button to your page and when the user clicks it you can try the following:

1. Create the new item.
2. Call RadGridView.Items.Insert(index, item);

I hope this helps.

All the best,
Ross
the Telerik team
0
Ramyashree
Top achievements
Rank 1
answered on 22 Feb 2011, 04:04 PM
I had tried it before itself..  In which case it will throw an exception saying that the Operation is invalid when Item Source is in use... Is there any other way of accomplishing it...?

Thanks in advance,
Ramya
0
Nedyalko Nikolov
Telerik team
answered on 23 Feb 2011, 07:21 AM
Hi Ramyashree,

Please accept my apologies. It is my mistake. The thing that you want is not possible.

Let me try to explain this.
RadGridView adds items via IEditableCollectionView interface which has no Insert method. Another reason about such behavior is that this "new item" may not enter into RadGridView's ItemsSource collection (edit could be canceled). In your case with RadDomainDataSource after Submitting changes the new item will enter to the right position according to filtering, sorting and paging. You could also use our special UI for adding new items, just set radGridView.ShowInsertRow = true (which shows an insert row (area) at the top of the grid).
Let me know if there is something unclear.

Best wishes,
Nedyalko Nikolov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
DomainDataSource
Asked by
Ramyashree
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Ramyashree
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Share this question
or