﻿<?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-Son-Garndson Listview</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 08 Jun 2026 05:43:25 GMT</lastBuildDate><ttl>20</ttl><item><title>Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23097.aspx</link><description>I have a Parent,Son,Grandson which I am trying to display. The Parent is on a Miantemence Form and works fine. I have the Son and Grandson in two ListvIews , side by side. The Son is dispaying fine. When I land on each record of the Son, I want the Grandson records to show, just for the relevant son. Nothing is being displayed on the Grandson list. I have set up as follows: The Foreign&amp;nbsp; Key for the Grandson is got from the Primary Key on the Son&lt;/P&gt;&lt;P&gt;SonBo.Navigated... This.ListView2.Requery();&amp;nbsp;&amp;nbsp;&amp;nbsp; //to requery the Grandson ListView&lt;/P&gt;&lt;P&gt;Grandson.ListView.Populating...&amp;nbsp; e.Parameters[0].value&amp;nbsp; = this.SonBO["Son_PK"];&amp;nbsp; //to&amp;nbsp;get Primary key from the Son&lt;/P&gt;&lt;P&gt;Grandson ListView.Properties... PopulateOnFormLoad=Manual&amp;nbsp; MethodToExecute=FillByParentPrimaryKey(Int32)&amp;nbsp; (primary key is Numeric)&lt;/P&gt;&lt;P&gt;What am I missing ?</description><pubDate>Thu, 21 May 2009 17:09:09 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23212.aspx</link><description>[quote][b]Gerard O Carroll (05/21/2009)[/b][hr]Is this the best way to do this[/quote]&lt;br&gt;
&lt;br&gt;
Yes, you want t run the List2.Requery() all the time so it can do just what is needed, show/remove records from the listview as per request.</description><pubDate>Thu, 21 May 2009 17:09:09 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23211.aspx</link><description>Putting in the List2.Requery() has got a little further. Thanks. Now, I can get&amp;nbsp;the grandchildren to display. &lt;P&gt;I had a porblem displaying the grandchildren as I scrolled up and down the Listview. I played around&amp;nbsp;with the AutonavigateToSelected&amp;nbsp;property &amp;nbsp;and the Tag field, and this is working now also.... is this yhe purpose of &amp;nbsp;this propery&amp;nbsp; ?&lt;/P&gt;&lt;P&gt;The only&amp;nbsp;issue I have right now is how to flush out the Grandchild List, if there are no grandchilden for a&amp;nbsp;partcular&amp;nbsp;son e,g, the following sequence A son with Grandchildren, the next son has no grandchildren. etc. I initially had a if BO1.Count &amp;gt; 0, but then this was not refreshing the Grandchildren , leaving the grandchildren from the previous record. If I took this If BO1.Count out, I got an error message.What I have ended up doing, which works, is as follows:&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;STRONG&gt;this&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;.idE_BO1.FillByParentPrimaryKey(0);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;.itR_BO1.Count &amp;gt; 0)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;{ &lt;/STRONG&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.idE_BO1.FillByParentPrimaryKey(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;.itR_BO1.ITR_PK); } &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;STRONG&gt;this&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;.listView2.Requery();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;i.e. I have filled first with a zero value&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is this the best way to do this&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;</description><pubDate>Thu, 21 May 2009 16:14:30 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23198.aspx</link><description>In the code that you provided, I don't see anywhere that you call the ListView2.Requery().  It is hard looking at an example like this as there is not much to go on since you did not provide a full sample.  If you have a sample that illustrates this that you could share then please post that as it would be easier to work with.&lt;br&gt;
&lt;br&gt;
The reason I am not sure exactly where to direct you as I don't exactly understand where your issue is.  Setting up a parent-&gt;child-&gt;grandchild and event deeper relationship is something that we work with on a daily basis...including within ListViews.  So at this point I know that it is just a matter of configuration.  But I am not sure exactly at which point you are having the issue.&lt;br&gt;
&lt;br&gt;
From just looking at your code, I see one issue here:&lt;br&gt;
&lt;br&gt;
[codesnippet]private void itR_BO1_Navigated(MicroFour.StrataFrame.Business.NavigatedEventArgs e)&lt;br&gt;
        {&lt;br&gt;
&lt;br&gt;
            if (this.itR_BO1.Count &gt; 0)&lt;br&gt;
                this.idE_BO1.FillByParentPrimaryKey(this.itR_BO1.ITR_PK);&lt;br&gt;
            &lt;br&gt;
        }[/codesnippet]&lt;br&gt;
&lt;br&gt;
You never call the listview2.Requery().  Based on my assumption of your code, shouldn't the code read:&lt;br&gt;
&lt;br&gt;
[codesnippet]private void itR_BO1_Navigated(MicroFour.StrataFrame.Business.NavigatedEventArgs e)&lt;br&gt;
        {&lt;br&gt;
&lt;br&gt;
            if (this.itR_BO1.Count &gt; 0)&lt;br&gt;
                this.idE_BO1.FillByParentPrimaryKey(this.itR_BO1.ITR_PK);&lt;br&gt;
          &lt;br&gt;
            listview2.Requery();&lt;br&gt;
        }[/codesnippet]</description><pubDate>Thu, 21 May 2009 06:16:55 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23197.aspx</link><description>Still having a few issues with grandchildren on a listview. I more or less copied Edhy's suggestions to my own app , but grandchildren are still not displaying. I can navigate the Child ok ,but nothing is showing up on the Grand-child listview. It is also displaying an error if I double Click on any of the childen records on ListView 1. Screen attched. (It also shows up the error the first time I do a single click on one of the children records) . I am also attaching the code for the screen&amp;nbsp; (This&amp;nbsp;uses similar structure to strataframe Sample with following&amp;nbsp;BO names that I have used in my app (&amp;nbsp;Cust = SMA&amp;nbsp;&amp;nbsp; Order=ITR&amp;nbsp; ORIT=IDE). The only other difference that I can see is that The Primary Key of My Customer File(SMA) is a string field rather than an&amp;nbsp;int field&amp;nbsp;.</description><pubDate>Thu, 21 May 2009 04:55:13 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23159.aspx</link><description>Edhy, thanks for your detailed explanations and help.&amp;nbsp; I know that Gerard as well as other developers that may run into this into the future will greatly appreciate your efforts!&lt;/P&gt;&lt;P&gt;Gerard, hang in there.&amp;nbsp; You are making progress each week.&amp;nbsp; Before long this will all be second-hand! ;)</description><pubDate>Mon, 18 May 2009 06:32:04 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23156.aspx</link><description>[quote][b]Gerard O Carroll (05/17/2009)[/b][hr]... I am just at that learning point on the curve where I reckon if I can get some concrete results on the next few weeks I will have made a lot of progress[/quote]&lt;br&gt;
&lt;br&gt;
Don't worry, you will do just fine, we all have been in the same spot sometime.&lt;br&gt;
&lt;br&gt;
The listview is my favorite control, it has been enhanced to do many thing automatically.  Read the Listview topic in the "UI Layer -&gt; Controls -&gt; ListView" help file.&lt;br&gt;
&lt;br&gt;
I have some free time now, so here is a quick description of how to populate it:  The ListView and the ComboBox uses the same type of population, they both have an internal BO to host their items.  When you use the Population Type Editor, you can select any method to be executed to fill the internal BO or you can use the BO.CopyDataFrom() method which requires you to have a BO dropped on the form to fill the internal ListView/ComboBox BO, this is the way I prefer to setup ListView since usually you may want to do something else with the data in the ListView and it is easier to manipulate the data in a BO dropped in the form.&lt;br&gt;
&lt;br&gt;
Using the BO.CopyDataFrom(BusinessLayerBase, BusinessCloneDataType) method, requires 2 parameters.  In the ListView.ListPopulating event you have to assign the values for those 2 parameters, I use VB.NET, but in you case it will look like this:&lt;br&gt;
&lt;br&gt;
[codesnippet]       private void listView1_ListPopulating(MicroFour.StrataFrame.UI.ListPopulatingEventArgs e)&lt;br&gt;
        {&lt;br&gt;
            e.Parameters[0].Value = this.oR_BO1;&lt;br&gt;
            e.Parameters[1].Value = MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromDefaultView;&lt;br&gt;
        }&lt;br&gt;
[/codesnippet]&lt;br&gt;
This way, when you call the ListView.Requery() it will copy the data from the BO assigned in Parameters[0] with the required BusinessCloseDataType that you use, in most cases "ClearAndFillFromDefaultView".&lt;br&gt;
&lt;br&gt;
Also pay attention to the "StrataFrame: User Interface Automation" properties you can use, in your case for the "Transactions" listview I used the "BusinessObject" and the "AutoNavigateToSelectedRecord" properties, this will have the effect that when you select any record in the ListView it will move the record pointer in the BO "oR_BO1" and trigger the oR_BO1.Navigated() event which will then requery the "Transactions Details" listview which has been in the same way as the "Transaction" listview.&lt;br&gt;
&lt;br&gt;
Hope this give you and others a clear view of how the ListView/ComboBox population works.  Check the references in the help file and also take a look at the StrataFlix sample which make use of the ListView and ComboBox in its own way.  Also keep in mind that this is just one way to populate these controls, SF provide us with a great flexibility on how to populate these controls which you will find out once you get more familiar with the framework.&lt;br&gt;</description><pubDate>Sun, 17 May 2009 12:38:32 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23155.aspx</link><description>Hi Edhy, many thanks for taking the time to unzip the app and having a look at it.&lt;/P&gt;&lt;P&gt;I have downloaded your zip, unzipped it and it runs fine.&lt;/P&gt;&lt;P&gt;I'll need some time to have a look at it in detail&lt;/P&gt;&lt;P&gt;I see you are using a BusinessCloneDataType.. not sure what that does but I'll have a closer look and see if I can sort out my own app with the help of your download.&lt;/P&gt;&lt;P&gt;Many thanks again for taking the time to look at this. I am just at that learning point on the curve where I reckon if I can get some concrete results on the next few weeks I will have made a lot of progress</description><pubDate>Sun, 17 May 2009 09:25:49 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23154.aspx</link><description>Hi Gerard,&lt;br&gt;
&lt;br&gt;
Sorry I don't have time now to explain in detail, but I changed the logic of your sample (see attached projects).  Look at the listviews population method and at the BOs Navigated events.&lt;br&gt;
&lt;br&gt;
Your BO relation definitions are OK.  You will see data from record 2.&lt;br&gt;
&lt;br&gt;
Have a nice weekend! :P</description><pubDate>Sat, 16 May 2009 12:30:24 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23153.aspx</link><description>Have gone back over the app...cannot see where I am going wrong. So I have set up another SamplE App using StRata Frame sample Sql Server Database....am still having the same problem trying to see the grandchildren....I know this must be something very simple that I cannot just see.. I am uploading two projects&lt;/P&gt;&lt;P&gt;SF_Samppl_App which has just 1 form (frmCust) (KEK_1.ZIP)&lt;/P&gt;&lt;P&gt;SF_SAMPLE_BO which is a BO Library with Cust,Orders and Order Lines BO set up. (KEK_2.ZIP)&lt;/P&gt;&lt;P&gt;I'd really apprEciate it if someone could have a look</description><pubDate>Sat, 16 May 2009 10:54:45 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23119.aspx</link><description>Hi Edhy.&lt;/P&gt;&lt;P&gt;I will go back over the app with a fine tooth comb..just thought that mabe I was missing ... some piece of code somewhere..if I still have issues, i'll do up a smple on SF database and post it</description><pubDate>Thu, 14 May 2009 11:56:03 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23116.aspx</link><description>[quote][b]Gerard O Carroll (05/14/2009)[/b][hr]...Just checked that , and the Instance of the GrandChild BO does have the parentBisinessObjectset to the Son[/quote]&lt;br&gt;
Then you will either need to post a sample using the StrataFrame Sample database or start debugging the listview.populating method to see if you are getting the right Parent PK value.&lt;br&gt;
&lt;br&gt;
[quote](By the way . in you last post , you had two lines, not separated by a Blank Line... how do you do that..all my lines have a blank line in between)[/quote]&lt;br&gt;
Sure I use the "CodeSnippet" IFCode shortcuts (from the left of your browser)&lt;br&gt;</description><pubDate>Thu, 14 May 2009 10:23:14 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23114.aspx</link><description>Hi Edhy,&lt;/P&gt;&lt;P&gt;Just checked that , and the Instance of the GrandChild BO does have the parentBisinessObject&amp;nbsp;set to the Son&lt;/P&gt;&lt;P&gt;(By the way . in you last post , you had two lines, not separated by a Blank Line... how do you do that..all my lines have a blank line in between)</description><pubDate>Thu, 14 May 2009 09:50:18 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23111.aspx</link><description>Hi Gerard,&lt;br&gt;
Make sure the instance of GrandsonBO.ParentBusinessObject in your form has the value of the SunBO.</description><pubDate>Thu, 14 May 2009 09:18:02 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23101.aspx</link><description>Hi Trent&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Verify that the relationship is setup between the Child -&amp;gt; GrandChild ........&lt;/STRONG&gt; Yes That is set up on the GrandChild BO&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Make sure that the Navigated event of the Child is on the correct record when the Requery is called for the grandchild............&lt;/STRONG&gt;The child records are displaying in List 1. I am expecting ,as I arrow down through this list, that the Grandchildren will appear automatically &amp;nbsp;in List 2&amp;nbsp;(The Grandchild) ..... is there something else here perhaps I need to call ??&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Make sure that you actually have records for the grandchild (I have done that before &lt;IMG title=Smile src="http://forum.strataframe.net/Skins/Classic/Images/EmotIcons/Smile.gif" align=absMiddle border=0&gt;)....&lt;/STRONG&gt; Yes I have double checked that &lt;/P&gt;&lt;P&gt;I just have about 25 records on each table &amp;nbsp;as a test so I can see whats happening a bit clearly</description><pubDate>Thu, 14 May 2009 08:03:17 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Parent-Son-Garndson Listview</title><link>http://forum.strataframe.net/FindPost23098.aspx</link><description>Well, with the infomration you have provided it is hard to tell what your code may be doing.&amp;nbsp; I see that you are calling the Fill method on the integer PK, but do you have the relationship setup on the BOs, etc.?&amp;nbsp; Here are some things to check:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Verify that the relationship is setup between the Child -&amp;gt; GrandChild&lt;/LI&gt;&lt;LI&gt;Make sure that the Navigated event of the Child is on the correct record when the Requery is called for the grandchild.&lt;/LI&gt;&lt;LI&gt;Make sure that you actually have records for the grandchild (I have done that before :))&lt;/LI&gt;&lt;/UL&gt;</description><pubDate>Thu, 14 May 2009 06:39:23 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>