how to force a 'SyncWithCurrencyManager' update

J

JohnR

I have multiple controls set to the same database and, normally, when I
change the record in one control the position is also changed in the other
controls because I have "syncwithcurrencymanager' set to true for all the
controls. I'm assuming that actual syncwithcurrencymanager for all the
controls gets executed when the event "BindingManagerPositionChanged" fires.

The problem occurs when I set a RowFilter on the defaultview of the table in
the dataset. If the application of the RowView causes the current record to
change (because the previously displayed record didn't match the filter
criteria) then the BindingContext(...).position changes BUT the
BindingManagerPositionChanged event does NOT fire. The record in the other
controls does not change. After applying the filter I need to click my
"Next Rec" then "Prev Rec" buttons to the the controls synced up again.

I probably can programmatically do a "next rec" and then a "prev rec" but
that won't work if the RowFilter results in only 1 record being exposed.

So the question is this: If I apply a RowFilter to a table how do I force
the SyncWithCurrencyManager to update all the controls that are controlled
by BindingContextManager?

Thanks...
 
C

Cor Ligthert [MVP]

John,

I have searched on internet (Google and MSDN's) for SyncWithCurrencyManager
and got one message.

However can you explain to us what property or whatever this is?

Cor
 
J

JohnR

Hi Cor,

Yes, Paul is correct. SyncWithCurrencyManager is an Infragistics
property. It determines if you wish the control to 'sync' with the
currencymanager or not. However, the basic problem is the same. The
question is whether it is a microsoft behavior or a behavior specific to the
Infragistic control... so let me rephrase the question and see if anybody
can shed some light on the issue...

Assuming you have multiple controls that are updated with the same
currencymanager, if you change the current record by, lets say, incrementing
the bindingmanager.position property then ALL the controls point to the same
new record. I suspect, but can't prove, that this is a reaction to the
BindingManagerBase.PositionChanged event firing. However if you change the
current record by virture of applying a RowFilter to the DataView then what
I'm seeing is that only the control that has focus when the
DataView.RowFilter was applied gets changed. The other controls still point
to the original record. I believe this is happening because, if the record
changes because you changed the RowFilter, the
BindingManagerBase.PositionChanged event does NOT fire (that I verified),
and, hence, the other controls never get notified to update their current
record.

My user interface is a tabbed display with one tab having the individual
fields displayed for the 'current' record. The other tab is an Infragistics
grid that has a row for each record in the database. By choosing a row (in
the grid row view tab) or buy clicking Prev Rec or Next Rec on the main tab
display everything works fine. The only issue is that if you are on the
main tab and set a rowfilter, the data on the main tab changes properly, but
the datagrid on the other tab does not.

I will also post this to the Infragistics site and see if anybody there can
tell me if it's a Infragistics issue or not.

Thanks, John
 
C

Cor Ligthert [MVP]

John,

That is in my idea why you can create New dataviews

With a New dataview you normally use its own currencymanager
With just declaring a dataview, you set a pointer to an old one (the
defaultview).

This is why you can create seperate dataviews, every datatable contains
already a dataview which is the property defaultview.

I hope that this answers slightly your question.

Cor
 
J

JohnR

Hi Cor,

Thanks for the reply... after some more research I found out that the
Infragistics Grid control does a "lazy" sync. That is, it does not actually
sync up with the currencymanager until it is painted. Because the grid was
on a separate tab, and not visible, it didn't sync up, which is why when I
tried to grab a field it was from the previously pointed to record. So what
I had to do is determine the row I needed manually, and not depend on the
grid being synced up.

Funny how everything becomes clear once you realize what is going on!

Thanks, John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top