Log In
[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Collapse]Binding to Data
    [Expand]Server Mode
     Grid Control Binding Specifics
     Posting Data to a Connected Database
     Unbound Columns
     Binding to Entity Framework Models
     Binding via Data Source Configuration Wizard
     Fluent API Support
     Member Table: Data Binding
     Tutorial: ADO.NET Data
     Tutorial: Create and Manage Columns at Design Time
     Tutorial: Create and Manage Data in Code and Apply Data Annotation Attributes
     Tutorial: Entity Framework Data
     Tutorial: Unbound Columns
     Tutorial: Working with Columns in Code
   [Expand]Grid View
   [Expand]View Technology
   [Expand]Data Editing
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Grid Control Binding Specifics

This document is an overview of data-binding points that are specific to the Grid Control.

Expanded Views

Data from a bound data source is represented in the Grid Control using Views. If the data source contains a single list of objects, this list will be represented using a single View - Main View. Its settings can be accessed via the GridControl.MainView property. The type of object that is assigned to a MainView property determines the current method of data representation. If this property is set to a GridView object (default value), then data is represented in a standard tabular format. If this property is set to a CardView object, data is represented using a card layout. See View Technology to learn about available Views.

After a Grid Control has been bound to a data source, it automatically retrieves available fields from the data source and creates corresponding columns in the Main View. To disable this feature, you can set the Main View's ColumnViewOptionsBehavior.AutoPopulateColumns property to false. If the Main View already contains specific columns, new columns are not created when a data source is assigned to the grid.

The Grid Control also supports hierarchical data sources, i.e., data sources with master-detail relationships set up between lists of objects. If such a data source is assigned to a grid, its master list will be displayed in the Main View, while child lists will be displayed at runtime in separate detail Views. In a master-detail mode, the Grid Control displays expand buttons ('+') in rows if they contain detail data. Clicking on an expand button creates a detail View that displays corresponding detail records.

At design time, when a Grid Control is bound to a data source that contains master-detail relationships, it doesn't automatically create detail Views. However, they will automatically be created at runtime, and their type and settings will be copied from the master View.


A business object bound to a Grid Control may contain properties of collection types (e.g., of the List<> type). These properties instruct the Grid to enable master-detail mode (see Implement Master-Detail Relationships for Objects via Collection Properties). Columns corresponding to collection properties are not created in a master View.

With the XtraGrid, it is possible to customize the type and settings of specific detail Views at design time. The only details you need to know are the names of the master-detail relationships in the data source. You can then associate specific master-detail relationships with specific Views via the Level Designer. To create an association, add a new level in the Level Designer or to the GridControl.LevelTree property in code. Relationships in the Grid Control are identified by their names.

The Retrieve Details button in the Level Designer enables you to retrieve names of existing relationships from a bound data source (the Grid Control must be bound to a DataTable object). Clicking the button creates levels for all relationships. Views, however, are not assigned to levels. You can do this manually using the Level Designer.

By default, the GridControl.ShowOnlyPredefinedDetails property is set to false. In this instance, the Grid Control can show detail Views for all relationships. If you set the GridControl.ShowOnlyPredefinedDetails property to true, the grid will only display relationships associated with Views (in the Level Designer at design time or the LevelTree property in code). Other relationships will not be displayed. Therefore, if there is no View associated with any master-detail relationship and the GridControl.ShowOnlyPredefinedDetails property is set to true, the grid will not allow you to expand any row to access the detail data, and the master-detail mode will be disabled.

You can prevent detail data from being displayed for a specific master View. To do this, set the master View's GridOptionsDetail.EnableMasterViewMode property to false.

To get the source of data displayed within a specific View, use the BaseView.DataSource property. This is especially useful in a master-detail mode.

Expanded Unbound Mode

The Grid Control doesn't support the unbound mode in which records would be added directly to a GridControl. Instead, records must be added to a bound data source, and then appear in the GridControl.

Generally, columns in the grid are bound to specific fields in a bound data source. It is possible, however, to add unbound columns that can display any data, not restricted to that data source. Such columns must be populated manually via an event. See the Unbound Columns topic for more information.

Expanded Regular and Server Data-Binding Modes

The Grid Control supports two data binding modes that differ in how data is retrieved from a data store.

  • regular data bound mode is a traditional data binding mechanism in .NET. Data from a data store is loaded to a data source component (DataSet, BindingSource, etc.), which is then connected to a grid control. This binding mode has slow performance when working with large datasets, as it requires all the data from the data store to be loaded into memory. However, it handles mid-sized recordsets perfectly.

    See Traditional Data Binding Methods for more information.

  • server mode is designed to work with large datasets. In this mode, the grid control is connected to a data store via a specifically designed data source object, tailored to work with huge recordsets (more than 50,000 records; the particular amount of data depends on your circumstances). Data is supplied to a grid control in small portions; it is never loaded into memory in its entirety. In addition, all data-aware operations are performed on the server side. All of this guarantees rapid data display and processing.

    See Server Mode for more details.

How would you rate this topic?​​​​​​​