﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » Parent / Child Relationships</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 28 Jul 2026 13:15:35 GMT</lastBuildDate><ttl>20</ttl><item><title>Parent / Child Relationships</title><link>http://forum.strataframe.net/FindPost12046.aspx</link><description>I'm using the the DevExpress XtraGrid to view a list of contacts and I am trying to add a custom unbound field to display a value from a child record but I am having trouble getting the proper value.&lt;P&gt;Here is how I am setup:&lt;BR&gt;2 BO's. Contacts &amp;amp; ContactPhoneNumbers on the form with the primary being the contacts.&lt;BR&gt;The parent/child relationship is established and I've set the ParentObject on the ContactPhoneNumbersBO to Contacts.&lt;BR&gt;The Contacts ChildAutoFilterOption property is set to MatchCurrentRow&lt;/P&gt;&lt;P&gt;The Contacts BO is attached to the grid via a BusinessBindingSource object.&lt;/P&gt;&lt;P&gt;I'm loading the Contacts BO and also the ContactPhoneNumbers BO using a custom Fill method which retrieves only the "primary" phone number for the contacts so pretty much all contacts and appropriate phone numbers are loaded during the contact's ParentFormLoading event.&lt;/P&gt;&lt;P&gt;What keeps happening is when the grid executes it's CustomUnboundColumnData event, I'm not able to access the child records.&lt;/P&gt;&lt;P&gt;Here is the event code I am using:&lt;/P&gt;&lt;P&gt;[Code]&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub gvMain_CustomUnboundColumnData(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs) Handles gvMain.CustomUnboundColumnData&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select Case e.Column.FieldName&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case gcPhoneNumber.FieldName&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oCurrentContact As Database.ContactsBO = CType(bbsContacts.Item(e.ListSourceRowIndex), Database.ContactsBO)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (oCurrentContact.ChildBusinessObjects.Count &amp;gt; 0) Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Value = CType(oCurrentContact.ChildBusinessObjects(0), Database.ContactPhoneNumbersBO).PhoneNumber&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;BR&gt;[/Code]&lt;/P&gt;&lt;P&gt;Can you point to what I am doing incorrectly?&lt;/P&gt;&lt;P&gt;TIA</description><pubDate>Fri, 19 Oct 2007 08:32:48 GMT</pubDate><dc:creator>Crones</dc:creator></item><item><title>RE: Parent / Child Relationships</title><link>http://forum.strataframe.net/FindPost12084.aspx</link><description>A view is probably a good direction to go.&amp;nbsp; You are welcome to send us a sample project that replicates the behavior that you are talking about.&amp;nbsp; We do not use DevExpress in-house, but if we can see a sample that points to the problem, then we can see if there is an easy solution as to what is going on with the grid and our BO interaction.&amp;nbsp; This probably falls more on the side of the Grid as long as you have the BBS attached to the grid as the data source.&amp;nbsp; But at any rate, send a sample and we will look at it in more depth.&amp;nbsp; Thanks. :)</description><pubDate>Fri, 19 Oct 2007 08:32:48 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Parent / Child Relationships</title><link>http://forum.strataframe.net/FindPost12073.aspx</link><description>I'd prefer not to query the database for each child record field to create the custom field (unless I'm missing something there), I'll utilize a view and create custom insert/update procedures.&amp;nbsp; Not my first choice, so if anybody else has a better option please let me know.&lt;/P&gt;&lt;P&gt;Thanks!</description><pubDate>Thu, 18 Oct 2007 15:38:50 GMT</pubDate><dc:creator>Crones</dc:creator></item><item><title>RE: Parent / Child Relationships</title><link>http://forum.strataframe.net/FindPost12051.aspx</link><description>Hi,&lt;br&gt;
I was struggling with XtraGrid custom unbound column with SF BO/Businesss BindingSource for a month. Even thought, DevExpress team try very best to help me on this issue (I sent my whole project to them for troubleshooting) also no luck. Beside, it also will cause a lot of strange behavour. According to DevExpress team, SF BO behavour is not as their expected. I have posted such a lot info to SF team, but I haven't get any news yet.&lt;br&gt;
&lt;br&gt;
Anyhow, I would said that, you would not able to access you BO record correctly in CustomUnboundData event. It always point to the same record.&lt;br&gt;
&lt;br&gt;
Try to try custom field for your child BO field, and bind it to XtraGrid directly.&lt;br&gt;
&lt;br&gt;
HTH</description><pubDate>Wed, 17 Oct 2007 20:17:09 GMT</pubDate><dc:creator>Chan</dc:creator></item></channel></rss>