Since I cannot bind datasource such way:
I should set parent_ID column of newly created row manually.
Please tell me how can done it.
The best solution for me is to set cell value when the editing of new row begins.
May be there is necessary event "NewRowCreated" ?
ADAdministrator Syncfusion Team May 13, 2004 03:50 AM
You can also bind it with:
DataSource = dataset1;
DataMember = table1;
And this will pick up the relation on table1, and auto populate the releated columns when you start editing a AddNew row in a child. Here is a little sample.
ADAdministrator Syncfusion Team May 13, 2004 04:35 AM
But in my situation I should show child table, not parent:
this.gridGroupingControl1.DataSource = ds;
this.gridGroupingControl1.DataMember = childTable.TableName;
And parentID will not be assigned automatically. :(
ADAdministrator Syncfusion Team May 13, 2004 08:12 AM
You can try handling the TableControlCurrentCellStartEditing event, and if it is teh AddNewRow, then set the value at this point.
private void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, GridTableControlCancelEventArgs e)
Element el = this.gridGroupingControl1.TableControl.Table.CurrentElement;
if(el != null && el is GridAddNewRecord)
Record r = el as Record;
int col = this.gridGroupingControl1.TableControl.CurrentCell.ColIndex;
int field = this.gridGroupingControl1.TableDescriptor.ColIndexToField(col);
int someParentID = 1;
ADAdministrator Syncfusion Team May 13, 2004 08:13 AM
You do not need the col and field lines in the above snippet.