Hi James,
You can add UnBoundFieldDescriptor for the columns that you want to dynamically change from either table to the grid. Then make one table the grid’s datasource and use .QueryValue event to dynamically provide the values from the other table. If you want to handle editing, you would also have to handle SaveValue event.
this.gridGroupingControl1.TableDescriptor.UnboundFields.Add("TableColumnTwo0");
this.gridGroupingControl1.TableDescriptor.UnboundFields.Add("TableColumnTwo1");
this.gridGroupingControl1.TableDescriptor.UnboundFields.Add("TableColumnTwo2");
//Used for saving/Editing the data in the filed.
private void gridGroupingControl1_SaveValue(object sender, FieldValueEventArgs e)
{
GridTable table = this.gridGroupingControl1.GetTable(e.TableDescriptor.Name);
int iRecordIndex = table.UnsortedRecords.IndexOf(e.Record);
string sColumnName = e.Field.Name;
table2.Rows[iRecordIndex][sColumnName] = e.Value;
}
//For display purpose....
private void gridGroupingControl1_QueryValue(object sender, FieldValueEventArgs e)
{
GridTable table = this.gridGroupingControl1.GetTable(e.TableDescriptor.Name);
int iRecordIndex = table.UnsortedRecords.IndexOf(e.Record);
string sColumnName = e.Field.Name;
e.Value = table2.Rows[iRecordIndex][sColumnName];
}
Please refer the sample for implementation.
CombineTables.zipBest Regards,
Haneef