Add record from ListView using a ChildForm


Author
Message
Juan Carlos Pazos
Juan Carlos Pazos
StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)
Group: Forum Members
Posts: 144, Visits: 227
Hi

I will try to explain this the more simple that I can:

I have a ListView that has a BO named PublicationsBO, the ListView has the usual Add, Edit, Delete buttons. I can add and edit records without problem using the ChildFormDialog.

The ChildForm has also a ListView that has ProductsForPublicationsBO, the relationships are setup and configured, I add a record manually and I can view in List and edit that record using another ChildFormDialog.

My problem is that if I add a new record to the ProductsForPublicationsBO the ParentKey field is not added -remains in 0 - so, this record is not realted to any Publication

In this same app, I use relationships, ChildFormDialogs but in all previous cases that dialogs are called from an MaintenanceForm, not from a ListView form - ChildForm. In all of those, the Parentkey is added by SF without problems.

Can you tell me how to add a new child correctly from a ChildForm?

Maybe StrataFlix does this, but I can not follow that sample because almost is done by code, and I'm not so good trying to addapt the ideas there.

Regards 

Smile Everything is possible, just keep trying...

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Juan Carlos,



In the help file search by "RegisterForeignKey", then take a look at the topic "Defining a Relationship Between Business Objects".

Probably you will need to manually assign the FK using the BO.RegisterForeingKey() method.

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Juan,

This could be due to the translations AFTER the BOs translated.  For grins, override the Onload of the child form.  After the MyBase.OnLoad() call, reset the instances of the relationship and I bet it will resolve your error.  The issue could be that the relationship is still referencing the original instance instead of the translated instance.

MyBase.OnLoad()
MyChildBo.ParentBusinessObject = MyparentBo

Juan Carlos Pazos
Juan Carlos Pazos
StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)
Group: Forum Members
Posts: 144, Visits: 227
Hi Trent

override the Onload of the child form

How do I override the onload? I never done this before.

Regards

Smile Everything is possible, just keep trying...

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Juan Carlos Pazos (04/08/2009)
Hi Trent



override the Onload of the child form




How do I override the onload? I never done this before.



Regards


Hi Juan Carlos

Just start typing overrides, follow Intellisense and choose the method you want to override, in this case the OnLoad().

Edhy Rijo

Juan Carlos Pazos
Juan Carlos Pazos
StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)
Group: Forum Members
Posts: 144, Visits: 227
Edhy

Thanks, I add this and works:

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)

MyBase.OnLoad(e)

PublicacionesProductosBO1.ParentBusinessObject = PublicacionesBO1

End Sub

Regards

Smile Everything is possible, just keep trying...

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