C# Grid Column Generation
The Kettic Data Grid Control uses the Data Grid Column objects to represent columns. The Kettic Data Grid Column is the base class of all types of grid columns. To generate columns for Data Grid control, we can use either automatic column generation based on the data source or C# code to add columns. The Kettic Data Grid Control provides a template with the AutoAddColumns property to apply each mode. We leave the default value as true to automatically generate the columns from data source. When we use this Data Grid control with other controls, we might need to add columns in C# code.
Add Columns Automatically
This mode is able to automatically generate separate column from data source for grid by setting the DataSource property to a collection of employees. This is the default value for column generation behavior and will complete the columns creation easily. However, we can also prevent the column generation for Data Grid Control by using the System.ComponentModel.BrowsableAttribute. The C# code below shows how to create columns for Data Grid.
Create Columns in C#
This mode will be applied when users of our UI WinForms Control want to use the Grid Control with other controls. Just disable the AutoAddColumns property by setting its value to false, and then we can add unbound or bound columns from data sources. The Grid Control will add the column by using the Columns collection of a template in Windows Forms. The data layer defines the type of auto generation columns. The C# code below shows how to generate columns for Data Grid manually.
UI Controlsfor Windows Forms.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls