Overview of Windows Forms DataGrid(SfDataGrid)

24 May 20234 minutes to read

The Windows Forms DataGrid (SfDataGrid) control is used to display collection of data in rows and columns. The SfDataGrid control includes editing and data shaping features (Sorting, grouping, filtering and etc) that allows the end users to easily manage the data.
Following are the key features of SfDataGrid control

  • Data binding – Supports to bind different types of data sources.
  • Selection – Support for row selection.
  • Editing – Interactive support to edit with different column types.
  • Columns – Support for various column types including unbound columns.
  • Sorting – Interactive support to sort the data in SfDataGrid.
  • Grouping – Interactive support to group the data in SfDataGrid.
  • Summaries – Extensive support to show brief information about the individual data columns or groups of rows.
  • Filtering – Interactive support for filtering data as like in Excel.
  • Validation – Support to validate the data on errors.
  • Master-Detail View – Support to display relational data using hierarchies.
  • Exporting – Support to export the data to Excel and PDF.
  • Styling – Extensive support for customizing styles of cells and rows in SfDataGrid.
  • Stacked Headers – Extensive support to show multiple headers called stacked headers.
  • Unbound rows – Support to display unbound rows.
  • Touch support – Complete support for resizing, drag-drop column, sorting, filtering, grouping and etc in touch devices

Choose between different grid controls

Syncfusion WinForms suite comes up with following different grid namely,

SfDataGrid

Windows Forms DataGrid (SfDataGrid) is designed based on column-oriented architecture that provides support to customize the grid easily. It is used to display collection of data in rows and columns. The SfDataGrid control includes editing and data shaping features (sorting, grouping, filtering, etc.,) that allows the end users to easily manage the data. It also supports printing and exporting to Excel and PDF file formats.

GridGroupingControl

GridGroupingControl is designed based on cell-oriented architecture that provides more control over cells and supports like Excel-like features. It supports expressions fields, filters, multi-column sorting, grouping, nested tables/hierarchies, and custom summaries. It is an unique UI and data virtualization architecture that provides instant scrolling capabilities, display millions of records, and handle real-time data updates with less CPU usage.

GridControl

GridControl is a cell-oriented grid that contains own data and does not need to be bound to the data source. It can be easily customized down to the cell level. It supports frozen rows, columns, Excel-like formulas and covered cells. It can also be used in a virtual manner such that it can bind to any type of data source.

SfDataGrid vs GridGroupingControl

Both SfDataGrid and GridGroupingControl used for same purpose. But SfDataGrid control offers rich set of features over GridGroupingControl. When you want the support for filtering, sorting, grouping, summary calculation and hierarchical data sources with the blazing performance, you can use SfDataGrid. Comparatively, the performance of SfDataGrid control is better than the GridGroupingControl.

You can see the list of some of the specific API difference between SfDataGrid and GridGroupingControl as follows:

SfDataGrid

GridGroupingControl

Description

AllowEditing TableDescriptor.AllowEdit To allow edit the cells.
AllowGrouping GridColumnDescriptor.AllowGroupByColumn To allow group the columns.
AllowSorting GridColumnDescriptor.AllowSort To allow sort the columns.
AllowFiltering GridColumnDescriptor.AllowFilter To enable filter in columns.
AllowDraggingColumns TableOptions.AllowDragColumns To enable dragging the columns.
AllowResizingColumns TableControl.AllowColumnResizeUsingCellBoundaries To enable resizing the columns.
ShowRowHeader ShowRowHeaders To show row header.
AutoGenerateRelations AutoPopulateRelations To generate the child relations for the grid.
RowHeaderWidth TableOptions.RowHeaderWidth To change row header width.
SelectionMode TableOptions.ListBoxSelectionMode To specify the mode of selection.
HeaderRowHeight TableOptions.ColumnHeaderRowHeight To change the row height of column header.

Below are the list of features in SfDataGrid over GridGroupingControl,

Feature

Description

Column auto sizing SfDataGrid enables fitting the width of the cell based on its content on demand for all columns or certain columns by using

AutoSizeColumnsMode

.
IEditableObjectSupport Windows Forms DataGrid (SfDataGrid) supports to roll back the changes when you press Esc Key by implementing IEditableObject interface. For more information about IEditableObject, refer

IEditableObject

.
Style customization Windows Forms DataGrid (SfDataGrid) control provides extensive support to customize the styles of cells and rows. To know more about styling in SfDataGrid, refer

here

.
Exporting to Excel Windows Forms DataGrid (SfDataGrid) control provides support to Export data to Excel and returns an ExcelEngine that contains the exported workbook. SfDataGrid Exporting is faster than GridGroupingControl. It takes very less time to export the huge amounts of data. To know more about exporting SfDataGrid to Excel, refer

here

.
Exporting to PDF Windows Forms DataGrid (SfDataGrid) control provides support for exporting the data into a PDF file. You can export Grouping, Filtering, Summaries and DetailsView, StackedHeaders in to PDF file. To know more about exporting SfDataGrid to PDF, refer

here

.
Data Virtualization Large amount of data can be loaded in less time by setting

EnableDataVirtualization

property to true.

Additional Help Resources

The Windows Forms SfDataGrid Knowledge Base section contains responses to some of the most common questions that other customers have asked us before. So this will be a good place to search for topics that are not covered in the user guide.

Similar to the Knowledge Base, the forum section also contains responses to questions that other customers have asked us in the past.