Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Expand]Controls and Libraries
 [Collapse]Common Features
  [Collapse]Data Binding Common Concepts
    How to: Bind GridControl to Database and Implement Master-Detail Mode at Design Time
    How to: Bind a Control to a Database at Runtime
    How to: Bind a Control to Data Created at Runtime
    How to: Bind a Control to Data in an XML File
    Traditional Data Binding Methods
    Data Source Configuration Wizard
    Data Binding Mechanism in ADO.NET
    Binding Controls to XML Data
    Binding Controls to Data Created at Runtime
    Add Unbound Data to a Data-Aware Control (XtraGrid, XtraPivotGrid)
    Binding to Excel Data Sources
    Binding to LINQ to SQL Classes
    Unbound Sources
    Binding to Entity Framework Core
    Binding to OData
    Binding to SQL Data
    Data Annotation Attributes
    How to: Add Virtual Rows Using the UnboundSource Component
    Obtaining Fields Available in Data Source
  [Expand]Data Source Wizard
  [Expand]Expressions
  [Expand]Behaviors
  [Expand]Application Appearance
  [Expand]Filtering UI Context
  [Expand]High DPI Support
  [Expand]Scaffolding Wizard
  [Expand]Formatting Values
   HTML Text Formatting
  [Expand]Menus
  [Expand]Tooltip Management
  [Expand]Saving and Restoring Layouts
   Clipboard - Copy Data and Formatting
   Version Compatibility: Default Property Values
  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]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Add Unbound Data to a Data-Aware Control (XtraGrid, XtraPivotGrid)

In most cases data-aware DevExpress .NET controls contain bound columns/fields that display data from bound data sources. In Grid Control and PivotGrid controls, it is possible to add unbound columns/fields that can display arbitrary data. Unbound columns are not bound to any field in a data source. You can provide data for these fields by specifying a formula (string expression) used to evaluate values or by handling an event

Tip

If you want to bind data without the currently existing ready-to-use source, use the UnboundSource component.

An unbound column/field must meet the following two requirements:

  • its FieldName property must be set to a unique value and not refer to any field in the control's data source;
  • its UnboundType property must be set to an appropriate value according to the type of data the column/field is supposed to display (Boolean, DateTime, Decimal, Integer, String or Object). It should not be set to an UnboundColumnType.Bound value. This property determines which default editor will be used to represent the column's values, how the values of the cells will be aligned, and which sorting and validity rules should be applied to the column, etc.

There is no difference between working with bound and unbound columns/fields. Unbound columns can be sorted, grouped and filtered in the same manner as bound columns. They also support summaries. When printing or exporting a control, the contents of unbound columns will be printed/exported as well.

Expanded Providing data using expressions

For an unbound column/field, you can specify a formula (string expression) that will be used to evaluate values for this field. Use the column's UnboundExpression property to specify an expression. At design time, you can invoke an Expression Editor via the Property Grid to build the expression. The Expressions section describes a syntax for creating formulas in code.

Expressions do not allow data entered by end-users to be saved. To create unbound columns and allow data entered by end-users to be saved, you need to provide data for unbound columns using an event (see below).

Expanded Providing data via an event

A specific event fires for unbound columns/fields, allowing data to be provided. In addition, in the Grid Control, this event allows data entered by an end-user to be saved. In the Grid Control control, use the ColumnView.CustomUnboundColumnData event. In the PivotGrid control, use the PivotGridControl.CustomUnboundFieldData event. These events are raised for each cell within unbound columns/fields.

Expanded Task-Based Help

Expanded See Also

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