BrowseDialog_Closed event, copy DataSource


Author
Message
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I need to provide browse dialog which its BO mapped to view that joint with three tables. In BrowseDialog_Closed event, I try to copy search result back to PrimaryBusinessObject, and seek to the selected record as code shown below. The datasource is copied, record located successfully, but the screen still show the first record.



Any ideas?



transfersBO.CopyDataFrom(v_PInvoiceTransfersBO, MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable);

transfersBO.CurrentDataTable.AcceptChanges();



if (!transfersBO.SeekToPrimaryKey(v_PInvoiceTransfersBO.TransferID))

{

MessageBox.Show("No data");

}


Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Hello Chan,

You'll want to use the NavigateToPrimaryKey() method rather than the SeekToPrimaryKey() method in this instance.  The difference between these two methods is that the NavigateToPrimaryKey() method will update any bound UI controls once the CurrentRowIndex is moved whereas the SeekToPrimaryKey() method will not update the UI at all.

Both methods exist since the extra step of updating the UI components takes time and, as such, makes the update a bit slower.  So when doing pure crunching without the need to update the UI the Seek methods are always faster.  For situations where you want to keep the UI updated to the state of the CurrentRow, the Navigate methods are the way to go.

So in your code above, change this:

    if (!transfersBO.SeekToPrimaryKey(v_PInvoiceTransfersBO.TransferID))

To this:

    if (!transfersBO.NavigateToPrimaryKey(v_PInvoiceTransfersBO.TransferID))

And you should be good to go!

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