|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Can't databind hierarchical datatop-level is a DataView on a table. I generate lower-level views by calling CreateChildView on individual rows (traversing the appropriate DataRelation objects). This works fine BUT NOT IF the primary key of a parent row changes. When this happens the corresponding childview (even though it is a RelatedView) show rows that are children of the parent row's original values, not of the parent row's new values, despite the fact that a cascading foreign key relation has been established. This means that I can't easily databind hierarchical data without the restriction that primary key values never change. Am I doing something wrong here? Is there an easy workaround? Below is a brief example. The phone numbers under Bob are a child view on the Bob row, and has a filter like "Find all phone numbers where Person = Bob". But if Bob's name changes to 'Bobby' the child view is not updated; it continues to look for phone's associated with Bob, of which there are none because of the cascading foreign key relation. My workound is to prevent the primary key from ever changing. So if a new person is added to the list, I need to collect their name modally before inserting it, after which it is read-only. Another workaround is for me to subclass DataView to look for changes to the parent row. Justin 234-3234 Bob 434-5545 984-5534 Mike 565-4543 |
|||||||||||||||||||||||