BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Query |
Solution |
Could you give the good example to show how to capture the cell value change event and then get the changed cell value to update the another cells value on the same row |
Solution 1
In order to achieve your scenario, you can use the Record.GetValue and Record.SetValue method to get\set the cell value in RecordValueChanged event. Please refer to the below code example,
Code example
this.gridGroupingControl1.Table.RecordValueChanged += Table_RecordValueChanged;
void Table_RecordValueChanged(object sender, RecordValueChangedEventArgs e)
{
if (e.Column == "Ship City")
{
Record record = e.Record;
//Get the record value of particular column.
string value = record.GetValue(e.Column).ToString();
//Update the value of column.
record.SetValue("Ship Country", value);
}
} |
Solution2
If you want to update the cell value while editing, you can use the TableControlCurrentCellEditingComplete event. This event will be triggered when editing is completed in current cell. Please refer to the below code example
Code example
this.gridGroupingControl1.TableControlCurrentCellEditingComplete+=
gridGroupingControl1_TableControlCurrentCellEditingComplete;
void gridGroupingControl1_TableControlCurrentCellEditingComplete(object sender, GridTableControlEventArgs e)
{
int col = this.gridGroupingControl1.TableDescriptor.ColIndexToField(currentCell.ColIndex);
string currentColumn = this.gridGroupingControl1.TableDescriptor.Columns[col].Name;
if (currentColumn == "Ship City")
{
Record record = this.gridGroupingControl1.Table.CurrentRecord;
string value = record.GetValue(currentColumn).ToString();
record.SetValue("Ship Country", value);
}
} |