This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, This is my first use of and OR Mapper so I'm pretty much a novice. Suppose I have a master-detail relationship and I want to use 2 datagrids and 2 text boxes, so it all works like this: Master Level: 1 master datagrid and 1 master text box (when I change the row on the datagrid, the text box also changes contents) Detail Level: 1 detail datagrid and 1 detail text box (when I change the row on the master datagrid, the detail rows are loaded on the detail datagrid; also, when I change the detail datagrid the detail text box also changes) Using datasets this is easy to accomplish by using a DataRelation. However, I'm having a hard time with LightSpeed, but I must be overlooking something, so please advise. Thank you. Paulo |
|
|
I'm not very au fait with Windows Forms data binding so there is probably a more elegant way to do this on the designer with BindingSources and such like, but hopefully this will be enough to get you started. The sample domain is that we have a set of Members each of whom has a set of Contributions (using a LightSpeed one-to-many association). Members have a UserName and Contributions have a Title. // Load top-level set into a BindingList instead of a normal list. See discussion As I say I am sure the setup of the grids and editor controls (text boxes) can also be done more nicely via the Windows Forms designer but this should at least point you in the right direction. |
|
|
Hello Ivan! Thank you for your reply. I tried your solution and everything works except for the fact that the ChildDetailBox gets the data relative for the first row in the DetailGrid but doesn't change when I change the row in the DetailGrid. I was already using a BindingList, and I've also tried to use BindingSources bound to entities, but the result is always the same: the detail boxes stay the same when I change rows on the detail grid. Of course, I can get the desired operation handling datagrid events manually, but I was looking for a similar solution to the one you can get with a DataRelation, to keep everything tidy. Is there anything else I could try? Thanks. Paulo |
|
|
Hello Paulo, That sounds a bit odd -- in my test sample, the content of the ChildDetailBox tracks the current row in the DetailGrid. I'm not sure what might be different in your project. Could you possibly zip up your solution and post it so I could have a look? You can attach files via the Options tab. (If it contains anything sensitive, you can instead mail it to me at ivan @ the obvious domain name, but you'll need to make sure that all the binaries are removed first.) Thanks! |
|
|
Hi Ivan, It was all my fault! Sorry for taking your time. After reading it was working on your side, I looked for differences and found 3:
The problem was, of course, on the third difference, because the DataMember was not being directly assigned. Changing this to what you've said from the beginning: DetailGrid.DataSource = members; solves the problem. Thank you so much for your help. Paulo |
|