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

RadGridView and .net RIA Services

3 Answers 92 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Natalia Penkova
Top achievements
Rank 1
Natalia Penkova asked on 22 Feb 2010, 01:26 AM
Hi All!

In RadGridView documentation (Loading Data from RIA Services) NorthwindDataSource class created with public property Customers, wich is of ObservableCollection type. Why do we need to do extra class with property, if in DomainDataContext all loaded entities are IEnumerable with INotifyCollectionChanged implementation (according to RIA Services documentation)?

I have tried to bind directly to LoadOperation.Entities. All works fine except RadGridView.BeginInsert() - new line does not appear (by the way DataForm works the same way). Does it mean that Ria Services doсs have mistake (look at LoadOperation.Entities property xml comments), or some bug in RadGridView control?

Thanks!



3 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 23 Feb 2010, 03:00 PM
Hello Natalia Penkova,

Generally RadGridView cannot add items automatically if underlying data source is IEnumerable.
RadGridView adds items via AddNew() method of the IList<T> interface, so your data source should implement IList<T> if you want to add items automatically. Another requirement is that T (from IList<T>) must have a default (parameterless) constructor.
In order to add items with different scenarios you have to handle RadGridView.AddingNewDataItem event and provide new instance to the NewObject parameter.

Let me know if this does not help.

Best wishes,
Nedyalko Nikolov
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.
0
Terry
Top achievements
Rank 1
answered on 25 Mar 2010, 10:58 PM
So does this mean that we cannot bind a RadGridView to collections of entities we get from RIA services if we want to allow the user to add rows?  If so, would we need to convert the entity collection from RIA to an IList<>, keep track of the changes through events, and then do the updates & inserts manually with the RIA CRUD operations for each changed or inserted row?

Is there a code example for this?

I'm using SL4 RC as well as Teleriks SL4 RC.  And indeed, Insert and BeginInsert() don't work when I'm bound to a RIA tab le entity collection.

Thanks,

Terry
0
Nedyalko Nikolov
Telerik team
answered on 31 Mar 2010, 12:18 PM
Hi Terry,

Could you please take a look at this forum post and let me know if there is something unclear?

Greetings,
Nedyalko Nikolov
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.
Tags
GridView
Asked by
Natalia Penkova
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Terry
Top achievements
Rank 1
Share this question
or