MultiRow Windows Forms > Developer's Guide > Using MultiRow > Managing Data > 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.
The value specified in the Cell.Value property is used as the default value in the newly added row.
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.
You can specify the default value in a newly added row using code in the DefaultValuesNeeded event.
This example uses the DefaultValuesNeeded event.
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 |
using GrapeCity.Win.MultiRow; private void gcMultiRow1_DefaultValuesNeeded(object sender, RowEventArgs e) { e.Row.Cells[0].Value = 12345; e.Row.Cells[1].Value = "ABC"; } |