Home Forums WinForms controls Xceed Grid for WinForms Default values in insertrow Reply To: Default values in insertrow

User (Old forums)
Post count: 23064

You can set the IdleValue property on the InsertionCell, and use it to set the value of the new DataRow if the user has not set it explicitly.

private void Form1_Load(object sender, EventArgs e)
//set the default value in the InsertionCell
( ( InsertionCell )insertionRow1.Cells[ 1 ] ).IdleValue = “other company”;
gridControl1.AddingDataRow += new AddingDataRowEventHandler( gridControl1_AddingDataRow );

void gridControl1_AddingDataRow( object sender, AddingDataRowEventArgs e )
//use the idle value to set the value of the corresponding cell of the DataRow
e.DataRow.Cells[ 1 ].Value = ( ( InsertionCell )insertionRow1.Cells[ 1 ] ).IdleValue;

Imported from legacy forums. Posted by André (had 2973 views)