Multi Row Record in Windows Forms GridDataBoundGrid(Classic)

26 Apr 2021 / 1 minute to read

DataBound Grid has support for displaying a single record in multiple rows.



For more details, refer to the following browser sample:

**_\Syncfusion\EssentialStudio\[Version Number]\Windows\GridDataBound.Windows\Samples\Customization\Multi Row Record Demo_**


Using the following code example, you can switch display of records from NorthWind’s Customers table between displaying a single row per record and multiple rows per record. The Binder.LayoutColumns function can be used to break records into multiple rows. The record can be broken by inserting a “.” in the LayoutColumns() function of GridHierarchyLevel class.

GridModel gridModel = gridDataBoundGrid1.Model;
GridModelDataBinder binder = gridDataBoundGrid1.Binder;

// "." indicates a new row.
binder.LayoutColumns(new string[] {"CustomerID", "CompanyName", "ContactTitle", "ContactName", ".", "Address", "City", ".", "PostalCode", "Country", "Phone", "Fax", "Region"});
Dim gridModel As GridModel = gridDataBoundGrid1.Model
Dim binder As GridModelDataBinder = gridDataBoundGrid1.Binder

' "." indicates a new row.
binder.LayoutColumns(New String() {"CustomerID", "CompanyName", "ContactTitle", "ContactName", ".", "Address", "City", ".", "PostalCode", "Country", "Phone", "Fax", "Region"})