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

EntitySet support

6 Answers 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Fahad
Top achievements
Rank 1
Fahad asked on 10 Jun 2011, 06:18 AM
Hi, I would like to know if there is any direct support for entity set with RadGridView? Right now I have to do all back-n-forth coding with an observablecollection to make things work. I'm guessing its not working because EntitySet doesn't implements IEditableCollectionView, Is that why its not working? Can you give me some details on how to directly use EntitySet without any other middle layer collection.

-Fahad

6 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 10 Jun 2011, 09:38 AM
Hello Arcot Mohamed Suhaib,

Generally you do not need IEditableCollectionView implementation all you need is INotifyPropertyChanged for the BO and INotifyCollectionChanged for the collection. I guess that you have problems to edit an entity if there is a sorting or grouping applied. The problem is that when an entity is edited and its position should be changed this will not happen automatically. In order to do that you have to remove the entity from the collection and add it again (this will raise property CollectionChanged events) and RadGridView will respond accordingly.
Let me know if this doesn't 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
Fahad
Top achievements
Rank 1
answered on 10 Jun 2011, 09:55 AM
Can you try binding the RadGridView to a EntitySet<T> and simply try adding inside the grid thru the insert row? This doesn't work. And WRT your answer on EntitySet not working with Sorting/Grouping, Why should the EntityCollection maintain that state? You have a QueryableCollectionView that gets created for any kind of IEnumerable right? Won't that view maintain all the state for grouping or sorting.
0
Nedyalko Nikolov
Telerik team
answered on 15 Jun 2011, 07:26 AM
Hi Fahad,

I'm attaching a sample application build with "WCF RIA Services v1.0 SP1". The application requires running SQLEXPRESS with Northwind database (otherwise you should change "NorthwindEntities" connection string inside web.config file).

Be aware that you should call SubmitChanges() on the same context to which RadGridView is bound to (this is a very common mistake).

Let me know if this doesn't 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
Fahad
Top achievements
Rank 1
answered on 15 Jun 2011, 08:26 AM
Either I must be missing something or this is sure a bug. Here is the demo video link, http://dl.dropbox.com/u/23500975/Telerik/2011-06-15_1251.zip

1) First time I load the sample with your implementation (which is what I also tried in my first attempt). As you can see If I click in the Add New Row nothing happens, It seems the grid is thinking that the collection is read-only.
2) Next time, I load my code which simply converts the entities into an ObservableCollection, and you can see that the newrow is now editable.

I did workaround this by wrapping up around an ObservableCollection<T> and using SubmitChanges accordingly. But I would like to know why this was not done automatically by the RadGrid.

-Fahad

0
Nedyalko Nikolov
Telerik team
answered on 15 Jun 2011, 09:24 AM
Hi Fahad,

Could you confirm that you have "WCF RIA Services v1.0 SP1" installed on your machine?
Indeed with the previous version of "RIA services" this scenario doesn't work, and you should handle RadGridView.AddingNewDataItem event.

Kind regards,
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
Fahad
Top achievements
Rank 1
answered on 15 Jun 2011, 10:07 AM
OK, that sounds fine, I'm not using SP1 here, can't upgrade now because of client deployment.

May be for you guys to support versions below SP1, You could just have a wrapper ObservableCollection around the EntitySet<T> internally, that just works without any big changes.

-Fahad
Tags
GridView
Asked by
Fahad
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Fahad
Top achievements
Rank 1
Share this question
or