Data Binding of C# DataGridView Control
When .NET Forms developers use the Data Grid Control, they can easily bind their application to any data sources without any code. It is also able to bind any XML, custom business object and web service directly to the Data Grid control in Windows Forms development environments. The data binding operation only need the data objects implement one of these interfaces, IList, IEnumarable, or ICollection. Additionally, the powerful data grid control supports out of the box binding to objects in sub directory as well as their properties for customizing.
Bind GridView to Data in C# Windows Forms
The Kettic DataGridView Control is capable of data binding to a single level of data or multiple levels of hierarchical data. With the unbound mode support, the Kettic DataGridView can be bound to no data. The GridView C# API in the Control suite allows users to display the data in columns and rows at runtime.
Data Types Support by GridView
Kettic DataGridView supports a variety of data sources, such as any XML, custom business object and web service. While using the Kettic Data GridView control, the data sources must implement IEnumerable interface and the data binding can be customized by using the interfaces, ITypedList, ICustomTypeDescriptor, and INotifyPropertyChange, with the business objects.
Binding to Array and ArrayList of Custom Objects
When bind the DataGridView component to Array and Arraylist, which contains supported data types available, we can easily assign the array to the DataSource property of the grid view in C# Windows Forms applications.
Binding to a Generic List,
The Kettic DataGridView is able to generate columns and read data for the business object properties that the control will be bound to. For instance, when we want to bind the GridView control to a list of integer type data, which does not have any properties, we will not get any data. Similarly, we will get a column represent the length of strings when we bind GridView to a collection of strings.
Binding to Sub Objects
Kettic DataGridView component provides the support of binding to sub objects by specifying through the FieldName property a dot.
Binding to Custom Collections
The default settings of Kettic DataGridView control will receive all data binding properties from the data source. And then, we can sort, filter, and group data by using these properties. However, we may not need to iterate grid instance via all the fields in the data source. So the DataGridView control allows passing to the data source property to create content when we have custom collection of business object.
The Unbound mode will not create content through data source for DataGridView. So, users of GridView control must add and remove the grid columns and rows by using the C# API included in the GridView WinForms Component or using the KetticGridView user interface, which support design time. Whatâs more, we can create a spreadsheet-like grid and leave the rows and columns empty for user typing their own data.
Bind GridView to Data Sources
The following are details that shows how to process the GridView data binding in C# Windows Forms projects. For example, binding GridView to a single level of data and multiple levels of hierarchical data, binding to Array and ArrayList or GenericList, binding to data table or DataSet, etc.
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