Beispiel #1
0
      private void dgridParent_Click(object sender, EventArgs e)
      {
         //  get the child rows of the currently selected row,
         //     based on the "FKProdCat" relationship.  Turn that
         //     array of rows into a table and make that table
         //     the DataSource of the child DataGrid.

         //  The Parent DataGrid's DataTable
         DataTable dtabParent =
            dgridParent.DataSource as DataTable;

         //  The selected row in the Parent DataGrid
         int ixSelectedRow = dgridParent.CurrentRowIndex;

         //  Retrieve the table of child rows.
         dgridChild.DataSource =
            UtilData.ConvertArrayToTable(
               dtabParent.Rows[ixSelectedRow]
                  .GetChildRows("FKProdCat"));
      }