Setting the value of a DisplayElementKind.AddNewRecord cell programmatically

Hello,

I manage to locate a cell with a code like this:

Me.GridGroupingControl1.TableModel(rowIndex, colIndex).TableCellIdentity.DisplayElement

and it happens to be a cell in the AddNewRecord line of an editable GridGroupingControl.

I want to set cell's value programmatically, so that when new record is saved to database, that is the saved value.

I've tried to use GetData() for that DisplayElement, but it is nothing for AddNewRecord elements, so I need another method to access cell's contents.

Thank you very much.

1 Reply

HA haneefm Syncfusion Team October 2, 2007 05:56 PM UTC

Hi José,

You can use the below code snippet to set the value of the AddNewRecord in a Grid.

//button''s click event
GridTable table = this.gridGroupingControl1.GetTable("TableName");
table.BeginEdit();

Record r = table.AddNewRecord;
if (r != null)
{
r.BeginEdit();
r.SetValue("ColumName", "BX");
r.EndEdit();
}
table.EndEdit();

Best regards,
Haneef

Loader.
Up arrow icon