GrapeCity MultiRow Windows Forms Documentation
Set Default Value in New Row

You can reduce the load on the user by automatically setting a default value in a newly added row. There are two ways you can set the default value in the GcMultiRow control.

Set the Template

The value specified in the Cell.Value property is used as the default value in the newly added row.

Set in the Data Source

When a data source is connected to the GcMultiRow control and a default value is specified in the column of the data source (System.Data.DataColumn.DefaultValue), this default value is used for the new grid row. This value has priority compared to the Cell.Value property.

Set using DefaultValuesNeeded Event

You can specify the default value in a newly added row using code in the DefaultValuesNeeded event.

Using Code

This example uses the DefaultValuesNeeded event.

[VB]

Imports GrapeCity.Win.MultiRow

Private Sub GcMultiRow1_DefaultValuesNeeded( _
    ByVal sender As System.Object, _
    ByVal e As RowEventArgs) _
    Handles GcMultiRow1.DefaultValuesNeeded
    e.Row.Cells(0).Value = 12345
    e.Row.Cells(1).Value = "ABC"
End Sub

[CS]

using GrapeCity.Win.MultiRow;

private void gcMultiRow1_DefaultValuesNeeded(object sender, RowEventArgs e)
{
    e.Row.Cells[0].Value = 12345;
    e.Row.Cells[1].Value = "ABC"; 
}
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options