Once you have the nested table, you can use it to get the associated TableControl. From the tableControl, you can use the same code as above to access the currentcell in that TableControl.
private void button1_Click(object sender, System.EventArgs e)
{
Element el = this.gridGroupingControl1.TableControl.Table.CurrentElement;
if(el != null)
{
if(el is GridRecord)
{
Record r = el as Record;
int col = this.gridGroupingControl1.TableControl.CurrentCell.ColIndex;
int field = this.gridGroupingControl1.TableDescriptor.ColIndexToField(col);
object o = r.GetValue(this.gridGroupingControl1.TableDescriptor.Fields[field]);
Console.WriteLine(o);
}
else if(el is GridNestedTable)
{
GridNestedTable gnt = el as GridNestedTable;
GridNestedTable gnt1 = gnt;
while(gnt1 != null && gnt1.ChildTable != null)
{
gnt = gnt1;
gnt1 = gnt.ChildTable.ParentTable.CurrentElement as GridNestedTable;
}
Record r = gnt.ChildTable.ParentTable.CurrentRecord;
string name = gnt.ChildTable.ParentTable.TableDescriptor.Name;
GridTableControl tableControl = this.gridGroupingControl1.GetTableControl(name);
int col = tableControl.CurrentCell.ColIndex;
int field = gnt.ChildTable.ParentTable.TableDescriptor.ColIndexToField(col);
object o = r.GetValue(gnt.ChildTable.ParentTable.TableDescriptor.Fields[field]);
Console.WriteLine(o);
}
}
}