Issue with Browse Dialog Datasource / BusinessBindingSource


Author
Message
Frank Jachim
Frank Jachim
StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)
Group: Forum Members
Posts: 4, Visits: 33
Trent;



Thanks that worked!, however, I had one anomaly as follows:



If the user select EDIT from the parent, I place the BusinessObject into EDIT(), then call the dialog. Interestingly, when I do this, lets say I have row 1 selected, I click EDIT and the child for appears, the record position may jump (both parent list and child form) to a different row, lets say row 3. However, on another occasion, it may remain on the currently selected row. I tried changing the position of the EDIT() and the only one I found to work was the following:



MyBO.SaveCurrentRowIndex()

MyBBS.BusinessObject = MyBO

MyBO.Edit() <<<<<<<<<<<<<<<<<<<<<<<< HERE

MyBO.RestoreCurrentRowIndex()



If I place it before the save index OR after the restore index, the anomaly reappears, also, if I remove the save/restore index it does not have the above issue.



This does appear to work, any comment and what is causing this and perhaps more importantly, is the above code a problem in any other respects?



Thanks,



Frank

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
Just save off the index prior to the update of the BBS and then restore it:

MyBO.SaveCurrentRowIndex()
MyBBS.BusinessObject = MyBO
MyBO.RestoreCurrentRowIndex()

Frank Jachim
Frank Jachim
StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)
Group: Forum Members
Posts: 4, Visits: 33
Trent;



Thanks once again for your prompt reply, it almost works, here is what happens:



The non-StrataFrame controls are now populated!, however, apparently resetting the BusinessObject on the BusinessBindingSource causes that instance of the BusinessObject on the child form to reposition to the first row in the datatable. Essentially, I am using the child form to edit the selected row present on the parent form, if I omit the code that you provided, then it is positioned properly (that is on the row selected on the parent form), however, the non-StrataFrame controls are no longer populated. Any further thoughts? Again, very much appreciated.



Thanks,



Frank
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
Ah...I bet that is your problem.  The ChildForm is more than likely not translating the BusinessObject reference on the BBS on the child form.  This is by design as it would really get messy is we had to reflect all objects.  Try overriding the OnLoad method of the child form, then after the MyBase.OnLoad(...) update the reference manually to the BBS:

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

    '-- Manually update the BO reference since at this point the BO translations will have happened and the BBS
    '   is still using the original instance instead of the translated instance.
    MyBindingSource.BusinessObject = Customers
End Sub


Frank Jachim
Frank Jachim
StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)
Group: Forum Members
Posts: 4, Visits: 33
Trent;



I appreciate your detailed reply, the browse dialog is now working as expected!, however, I am still experiencing the following issue when binding a non-StrataFrame control:



I am using a ChildFormDialog to share a data session between the primary and a secondary form. On the the secondary form (child) I have the matching (connected) business object and a BusinessBindingSource that references that business object to provide connectivity to the non-StrataFrame controls on the child form. I have made the recommended adjustments you mentioned, however, these non-StrataFrame controls will not populate. This occurs with both the Microsoft standard controls and the DevExpress controls that I am using. I should mention that the BusinessBindingSource now works as expected with non-StrataFrame controls on the primary form. Any thoughts would be greatly appreciated.



Thanks,



Frank
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
Thanks for your comments about the framework.  Let me see if I can address your questions.

My application utilizes a few different databases, therefore, I manually add the datasources in my opening code, however, the issue that I am experiencing is that when I use a Browse Dialog, regardless of the DataSourceKey that I use on the associated business object (connected to the Browse Dialog), the browse search uses the default application connection, therefore, if that does not happen to be the database that has the table I need to browse I will receive an "Invalid Object Name" error. How can I resolve this issue?

It sounds like you do not have the DataSourceKey set up on the BO declaration itself.  When the BrowseDialog performs a query, it creates a unique internal instance off of the BusinessObjectToPopulate.  So in this case, if you just have the DataSOurceKey set on the instance of the BO that attached to this property, then it would not work.  However, if you set this on the declaration of the BO (double-click the BO from the solution explorer and set it in teh component designer of the BO) then this should work.  That would be my first inclination  of what is going on.

I need to utilize some Developer Express controls, I use the BusinessBindingSource to connect this controls, however, I noticed that sometimes they "lose" their connectivity to the datasource, whereas, the StrataFrame controls are working properly. Any idea on what may be the cause of this apparently sporadic behavior?

More than likely you just do not have the property update mode set to PropertyChanged instead of OnValidated.  If you adjust the binding to update the data source OnPropertyChanged versus OnValidated (default) then you will probably not experience this behavior.  By default, the standard SF data binding does this for you.

First, select the control in question and then go to the Advanced section under the data bindings:

Next, open the advanced region, select the property to which you want to bind, and then adjust the update mode:

That should take care of that "sometimes loses connection" behavior.

Frank Jachim
Frank Jachim
StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)
Group: Forum Members
Posts: 4, Visits: 33
I am currently working with a trial copy of the framework, very impressed with the product, however, I am experiencing the following issue:



1. My application utilizes a few different databases, therefore, I manually add the datasources in my opening code, however, the issue that I am experiencing is that when I use a Browse Dialog, regardless of the DataSourceKey that I use on the associated business object (connected to the Browse Dialog), the browse search uses the default application connection, therefore, if that does not happen to be the database that has the table I need to browse I will receive an "Invalid Object Name" error. How can I resolve this issue?



2. I need to utilize some Developer Express controls, I use the BusinessBindingSource to connect this controls, however, I noticed that sometimes they "lose" their connectivity to the datasource, whereas, the StrataFrame controls are working properly. Any idea on what may be the cause of this apparently sporadic behavior?



Again, I think this is a great framework, however, I do need to get past these issues for my intended application, my issues may very well be my ignorance of the frameworks operation. Any help would be greatly appreciated.



Thanks,



Frank

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