I have written a custom databound grid control that we've been using
successfully for months, but one of our developers has just run into a
problem that I can't figure out.
The code for setting it up is as follows:
DataSet dataSet = new DataSet( "TestSet" );
DataTable tableParent = dataSet.Tables.Add( "TableParent" );
tableParent.Columns.Add( "ID", typeof( Int32 ) );
tableParent.Columns[ "ID" ].AutoIncrement = true;
tableParent.Columns[ "ID" ].Unique = true;
tableParent.Columns.Add( "Col1", typeof(Int32) );
tableParent.Columns.Add( "Col2", typeof(Int32) );
DataTable tableChild = dataSet.Tables.Add( "TableChild" );
tableChild.Columns.Add( "ID", typeof( Int32 ) );
tableChild.Columns.Add( "Col1", typeof(Int32) );
tableChild.Columns.Add( "Col2", typeof(Int32) );
dataSet.Relations.Add( "Child2Parent", tableParent.Columns[ "ID" ],
tableChild.Columns[ "ID" ] ).Nested = true;
gridParent.DataSource = dataSet;
gridParent.DataMember = "TableParent";
gridChild.DataSource = dataSet;
gridChild.DataMember = "TableParent.Child2Parent";
The way it is supposed to work (and does work with the MS DataGrid) is that
when you select a row in the parent table, it should set the data in the
child table to all children of the selected parent.
In my grid, when the current cell changes, I set the position in the
CurrencyManager to the new position. My understanding (and apparently a
false one) was that the CurrencyManager would update the position in the
underlying dataset which in turn would then inform all CurrencyManagers
bound to it. Apparently that's not the case.
The parent grid receives the CurrencyManager.PositionChanged event but the
child grid receives no events from its CurrencyManager.
How am I supposed to propagate an update to the child grid?
Thanks.
Pete