Question about setting up a Parent Child Demo...


Author
Message
StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
I know I started an exhaustive thread on this months ago, but you guys have made some changes to the framework so I have new questions. Hehe

Ok, I'm trying to re-familiarize myself with the BO relationship aspect of the framework. I printed out all the tutorials from the newest version of the help file and re-worked my way through all of the related ones until i got to Tutorial_WinVB_14. Tutorial 14 shows me how to create the child BO and make the necessary settings to link the child BO to the parent.

At the end of tutorial 14 it says: "Designing a child form that will show the use of a business object relationship is beyond the scope of this tutorial."

So now my question is: Since I've worked my way through all the tutorials up through 14 and I want place a grid on the CustomerMaintenance form to show the related orders, how do I do this?

I thought you guys used to have a grid that was simply an inherited version of the Datagridview but I couldnt find it. I tried to drop a standard DataGridView onto the form using a BusinessBindingSource control but that didnt work.

Since there have been some changes to the framework since the last time i asked this question... could you please explain it again?

Thanks

StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Hello?
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, we've never had an inherited grid... we stay completely away from those things.  So, we designed the BusinessBindingSource to allow you to bind your business objects to grids.  To do this:

1) Drop a DataGridView on your form

2) Drop a BusinessBindingSource on your form

3) Drop a child bo on your form (or any bo, but you mentioned children in your post).

4) Set the BusinessObject property on the BBS to the child business object

5) Set the DataSource property on the DataGridView to the BBS (it won't show up under the root node... you have to expand the "Other Data Sources" node, and then expand the "<FormName> List Instances" node to see the BBS that you dropped on the form.

6) The grid automatically generates the columns and then you are free to configure the grid as you see fit.

StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Ok, I'll try that.

The other question I had about Tutorial 14 was... when you create the orders BO you never mentioned in the tutorial that you needed a fill method created.  Is that right?

I understand the parent has a fill method and the link between the parent and the child is created but how does the child BO get populated with the related records?

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Ah, the reason that I never created a fill method was because the BusinessLayer class already has a FillByParent() and a FillByParentPrimaryKey() that can be used to pull child records of a parent business object.  You can also write your own fill method, and then filter the records through the ChildAutoFilterOption on the parent business object.
StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Ok, I've done all that. However, when I connect the DataGridView to the BusinessBindingSource and then run the it disables the navigation buttons. Pictured below:

Is there something i'm missing?

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The navigation buttons go off of the object that is the specified by the IncludeInFormNavigate property on the form.  My guess is that the child bo is the first one that you dropped on the form, and it's the primary.  So, when the form loads, the grid automatically adds a record (notice the -1 in the primary key blank) because that's what grids do, and when it adds the record, since the child bo is the primary business object (since it was the first one dropped on the form), it disables the navigation buttons because the business object is currently "adding" and the AllowMultipleModifiedRows of the business object is false.  So, you'll want to do a few things... set your parent business object to be the PrimaryBusinessObject of the form, disable the automatic adding of new rows in the grid (I think it's AllowNewRow or AllowAdd) and add an Add button so that you can manually add new records to the grid rather than letting it automatically create new rows at will.
StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
I checked the ParentBusinessObject of the form and it was set to the parent. I then set the AllowUserToAddRows to False and it worked. It populated the Grid based on the parent that I navigated to.

Here is my next round of questions... Hehe

Does setting AllowUserToAddRows to false prohibit me from adding new rows programmatically?

More importantly, If the form and parent object are a Maintenance form and the child is a grid... how is the add,edit, delete, navigation in the child grid handled? Yknow how do I know or trap if changes have been made and prompt the user to save? or disable navigating to a different parent or child record until the changes have either been committed or canceled?

Thanks

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No, you can still call Add() on the business object to add a new record... it just keeps the grid from trying to add new rows on its own. 

As for state handling... you can handle the EditingStateChanged event of the child business object and enable/disable the appropriate buttons.

StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
But I cant use the toolstrip that comes with the Maintenance form for the child bo, right?

I'll need separate buttons for add, edit, delete, save, undo, and navigation for the grid/child BO, right?

If i attempt to navigate away from the parent record, how can i detect if there were changes made in any of the child records and then prompt the user?

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search