Articles in this section
Category / Section

How to add a default value to add new record fields in WinForms GridGroupingControl?

1 min read

Adding default value to new record field

In order to add default value to AddNewRecord in GridGroupingControl, ShowDefaultValuesInAddNewRecord and DefaultValue properties can be used.

The DefaultValue property can be accessed through TableDescriptor.Fields property and the default value can be set using this property.

C#

//Form()
//Add the default value in AddNewRecord.
this.gridGroupingControl1.ShowDefaultValuesInAddNewRecord = true;
 
foreach (GridColumnDescriptor column in this.gridGroupingControl1.TableDescriptor.Columns)
{
    this.gridGroupingControl1.TableDescriptor.Fields[column.Name].DefaultValue = column.Name + "_" + "DefaultValue";
}

VB

'Form()
'Add the default value in AddNewRecord.
Me.gridGroupingControl1.ShowDefaultValuesInAddNewRecord = True
 
For Each column As GridColumnDescriptor In Me.gridGroupingControl1.TableDescriptor.Columns
 Me.gridGroupingControl1.TableDescriptor.Fields(column.Name).DefaultValue = column.Name & "_" & "DefaultValue"
Next column

 

Add default value to new record

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied