Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

A master-detail grid with Entity Framework objects

$
0
0

Starting with version 2012 vol 1, it is possible to enable the master-detail feature for collection properties generated by Entity Framework. See the Use Master-detail views with generic collections of type IList<T> and IEnumerable thread for details.

This example demonstrates how to bind related entities to the XtraGrid and display them in master-detail views.

See also:How to display Entity Framework objects in a grid within master-detail mode when entities have many-to-many relationship and a linked table is included to an entity model

Question Comments

Added By: Josh Soriano at: 8/16/2013 5:53:31 PM    

my problem is im using EF5 which preferred using DbSet instead of ObjectQuery, and how can i add a row in child grid...

Added By: Hassan Gulzar at: 2/1/2015 5:30:13 AM    

Same issue here as Josh said above. EF5 and onwards, the line gridControl1.DataSource = new BindingSource(customersQuery, ""); becomes invalid as customersQuery needs to have a .ToList() and that defeats the purpose because 1) I cannot have the CRUD ops auto reflect on the context 2) I cannot have one save button to submit all the changes.

Added By: Nikita (DevExpress Support) at: 2/2/2015 12:21:40 AM    

Hello Hassan,
We have a separate How to implement CRUD operations when Entity Framework 5 is used example that illustrates how to use Master-Detail mode. I see that you have published a comment about an issue that occurs when using the approach suggested in that ticket. We will post an answer to your inquiry shortly. 

Added By: Yasin Türk 1 at: 12/7/2015 4:28:31 AM    

how can i design childlist gridview.. column names, field names etc

Added By: Nikita (DevExpress Support) at: 12/7/2015 7:50:36 AM    

Hello,
You can use the common approach described in the Detail Pattern and Clone Views. In this case, the relation name of the pattern view should equal to the name of the related navigation property in the entity model.


Viewing all articles
Browse latest Browse all 7205

Trending Articles