G
Gregory Persson
I am using a Windows Forms DataGrid to display a DataSet with two tables
using a parent / child relationship. I set this up with the following code:
parentColumn = ds.Tables["Parent"].Columns["ID"];
childColumn = ds.Tables["Child"].Columns["ID"];
dr = new DataRelation("RelParentChild",parentColumn, childColumn);
ds.Relations.Add(dr);
grid.SetDataBinding( ds, "Parent" );
* I need to access information from the Child Table when the user
double-clicks it.
gridWIP.CurrentRowIndex stores the value of the Parent Table and does not
change while the Child Table is being displayed.
Furthermore, this.BindingContext[ dsWIP, "Child" ] appears to be useless:
None of the events fire and the Current & Position values never change.
I can probably access the information I need using the MouseDown event & the
HitTest, but I need to be able to determine which Table the DataGrid is
showing at the time, and I'm not sure how to do that either.
Any suggestions or links to futher reading would be appreciated.
Sincerely,
Greg Persson
using a parent / child relationship. I set this up with the following code:
parentColumn = ds.Tables["Parent"].Columns["ID"];
childColumn = ds.Tables["Child"].Columns["ID"];
dr = new DataRelation("RelParentChild",parentColumn, childColumn);
ds.Relations.Add(dr);
grid.SetDataBinding( ds, "Parent" );
* I need to access information from the Child Table when the user
double-clicks it.
gridWIP.CurrentRowIndex stores the value of the Parent Table and does not
change while the Child Table is being displayed.
Furthermore, this.BindingContext[ dsWIP, "Child" ] appears to be useless:
None of the events fire and the Current & Position values never change.
I can probably access the information I need using the MouseDown event & the
HitTest, but I need to be able to determine which Table the DataGrid is
showing at the time, and I'm not sure how to do that either.
Any suggestions or links to futher reading would be appreciated.
Sincerely,
Greg Persson