By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,131 Members | 1,437 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,131 IT Pros & Developers. It's quick & easy.

RelatedCurrencyManager Binding Errors when Bound to Filtered DataView that contains no Results (MS Bug??)

P: n/a
I've been experiencing some frustrating behavior that I believe may be a MS bug in the Framework. Has anyone else experienced this, know a better way to resolve it, or if it is an actual MS bug

*) I have a DataSet containing 2 tables, A and B
*) There is a 1-to-1 relation between the tables with table A being the parent. (ABrel
*) A DataView is created on table A to allow filtering of the result se
*) 2 Text Boxes are created and Bound to a column in table A and B through the Datavie
-> box1.DataBindings.Add(new Binding("Text", DataView, "col1"
-> box2.DataBindings.Add(new Binding("Text", DataView, "ABrel.col1"

As the DataView's Row filter changes, all appears to work fine. The values displayed in the boxes change as they should, until the filter produces no results. When no results are found, the following occurs
*) box1 goes blank and binding is suspende
*) box2 contains the prior bound value, and is not suspended. This value can be edited and the changes will be made to the prior binding!

Using the Debugger I'm able to confirm the following about the binding contexts

*) BindingContext(DataView) is of type CurrencyManager and is Suspended when no results exist in DataVie
*) BindingContext(DataView, "ABrel") is of type RelatedCurrencyManager and is not Suspended when no results exist in DataView

I assume that this behavior is a bug and not designed for. When a parent is suspended, all children should be suspended as well

The fix I found, is that each time the filter is applied to the DataView I have to perform the following statement

DataView.RowFilter = <new value
if( DataView.Count = 0 ) The
Me.BindingContext(DataView, "ABrel").SuspendBinding(
els
Me.BindingContext(DataView, "ABrel").ResumeBinding(
End I

This seems unnecessary since the Framework automatically handles suspending the parent CurrencyManager: BindingContext(DataView)

Has anyone else encountered this? Do you know why if MS designed it to behave this way

Thanks in advance for any information
Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.