We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to find column and change values in this column?

Hello there

I got a little problem with a grouping grid (version 4.4).
What I want to accomplish:
Use a combobox to select a cell value and via code insert a second value into another cell.

We have some old code which inherits the grouping grid and tries to add this functionality:

for(int i=0;i < this.TableDescriptor.Columns.Count;i++)
{
if (this.TableDescriptor.Columns[i].Name == "comboBoxColumn")
{
colIndex = i + 1 + this.TableDescriptor.GroupedColumns.Count;
}

this.TableControl.Model[this.TableControl.CurrentCell.RowIndex,intBrennstoff].CellValue = "NewValue";

This only works when the visible columns are in the same order as in the TableDescriptor.Columns collection.
Otherwise the indexes of the two collection are different and the code tries to write into the wrong column.

I can't set the cell value through TableDescriptor.Columns and I can't find the right column through TableControl.Model...

Any idea how I can work around this problem?



2 Replies

FA Fabian November 14, 2008 08:00 AM UTC

Sorry, the last code line should look like this:
this.TableControl.Model[this.TableControl.CurrentCell.RowIndex, colIndex].CellValue = "NewValue";



JJ Jisha Joy Syncfusion Team November 17, 2008 07:29 AM UTC

Hi Fabian,

Thank you for posting query to us.

This can be achieved by setting the value by means of Table.CurrentRecord.SetValue method. Please refer the code:

this.gridGroupingControl1.Table.CurrentRecord.SetValue("ColumnName", value);

Please let me know if this helps.

Regards,
Jisha






Loader.
Live Chat Icon For mobile
Up arrow icon