New Posts New Posts RSS Feed: DevExpress grid binding
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

DevExpress grid binding

 Post Reply Post Reply
Author
stevenr View Drop Down
Newbie
Newbie


Joined: 09-Nov-2009
Posts: 9
Post Options Post Options   Quote stevenr Quote  Post ReplyReply Direct Link To This Post Topic: DevExpress grid binding
    Posted: 05-Mar-2012 at 11:02am
OK, I think I have it working now. Thank you for you insight.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 21-Feb-2012 at 5:31pm

The problem here is in the Master-Detail relationship, which should be a 1:m, where one Master can have many Details. The relationship as defined in the ORM is somewhat reversed, with a Detail having many Masters, although that's not causing the problem.

If you profile this sample (I used SQL Profiler) you'll see a query executed to fulfill the Master.Detail navigation property for every Master record. The query is basically something like "select * from Detail where masterid = n". The query isn't constrained by locale, and with the data in these tables will return 2 detail records for every master. The order in which these records are returned and processed by DevForce is undefined, so if aMaster.Detail ends up being in the list of Details then it will be displayed, otherwise it's blank.
 
One way to fix this is to use a custom property on Master which contains an EntityQuery to select the one detail record for the master and locale wanted.
Back to Top
stevenr View Drop Down
Newbie
Newbie


Joined: 09-Nov-2009
Posts: 9
Post Options Post Options   Quote stevenr Quote  Post ReplyReply Direct Link To This Post Posted: 21-Feb-2012 at 11:10am

I've seen this behavior off and on but could never reproduce it consistently until now. It appears to happen only when using the IdeaBlade DevForce Classic XtraGridBindingManager control to communicate with a database through the IdeaBlade layer. However, the problem does *not* appear to be with IdeaBlade because I can see that the proper data is looked up in memory but it is just not being displayed correctly on the screen.

What I'm trying to do is to display the contents of a master table and one column of a detail table inside one grid. Because a one-to-many relationship exists in the database between the master and the detail tables, that grid column is formatted as a LookupEdit column.

To repro:
 1. Create a new database named gridbindingbug on the default local instance of SQL Server 2008 and run the attached script.sql file. This script creates a table Master and a table Details and populates them with the necessary data.
 2. Build and run the solution. When the application window shows, you will see one or more cells of the Details column in the grid show up empty.

When I tried to reproduce this scenario with XML datasets, the grid worked properly. At first I thought that the problem was with the DevExpress grid control because after all I can see the correct data in memory. So I posted a question on the DevExpress forum. As you can see, however, they referred me back to IdeaBlade, which now leads me to believe that the problem is with the binding manager that you developed for DevExpress:


http://www.devexpress.com/issue=Q382084

 

Thank you for the attached project. It helped me reproduce this problem. The issue is caused by the fact that GridControl cannot correctly operate complex data types as in case of the Detail class. To operate these data types, I suggest you use unbound columns (ms-help://DevExpress.NETv11.2/DevExpress.WindowsForms/CustomDocument1477.htm). If you do not want to use them, I suggest you contact the IdeaBlade support team to resolve this problem.

I have tried to follow their suggestion of using unbound grid columns, but that's not working either.

uploads/627/GridBindingBug.zip

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down