StrataFrame Forum

BrowseDialog_Closed event, copy DataSource

http://forum.strataframe.net/Topic10200.aspx

By Chan - 7/11/2007

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");

}

By Dustin Taylor - 7/11/2007

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!