title: GridLookUpEdit and Multi-part Keys
body: <p>I realize that the DevExpress GridLookUpEdit editor was not designed to work with data that has multi-part keys.  However, I am trying to workaround this limitation anyway.</p>
  
  <p>The data for my GridLookUpEdit is Product-Purity with two columns "PRODUCT_ID" and "PURITY_ID".  I have this code to set the purity of the underlying grid when the user selects the product-purity row in the GridLookupEdit:</p>
  
  <pre><code>    void lookUpEditProductPurities_EditValueChanged(object sender, EventArgs e)
      {
          // Get the purity from the product selected and update the purity column of the grid.
          DevExpress.XtraEditors.GridLookUpEdit editor = (sender as DevExpress.XtraEditors.GridLookUpEdit);
          DevExpress.XtraGrid.Views.Grid.GridView view = editor.Properties.View as DevExpress.XtraGrid.Views.Grid.GridView;
          object val = view.GetRowCellValue(view.FocusedRowHandle, "PURITY_ID");
          if (editor.Parent is GridControl)
          {
              GridControl ParentGridControl = (editor.Parent as GridControl);
              GridView ParentGridView = (ParentGridControl.MainView as GridView);
              DataRow CurrentDataRow = ParentGridView.GetDataRow(ParentGridView.FocusedRowHandle);
              CurrentDataRow["PRODUCT_PURITY_ID"] = val;
          }
      }
  </code></pre>
  
  <p>This works fine when I use it from a master grid, with one small problem.  When an existing row refers to a purity that is not the first purity for a product, popping the grid will make it appear as though the first purity is selected.  This is not a big deal as far as I am concerned.</p>
  
  <p>However: the big problem I am having is when I use this GridLookUpEdit in a detail row of a master-detail grid.  The call: editor.Parent is returning the grid control for the master and ParentGridControl.MainView is returning the GridView for the master.</p>
  
  <p>How do I get at the gridView that the GridLookUpEdit is an editor for - the child gridView??</p>
  
  <p>tia -</p>