[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Grid View
  [Expand]Tree List
  [Expand]Card View
  [Expand]Chart Control
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Expand]Data Editors
  [Expand]Docking and Popups
  [Expand]File Management
  [Collapse]Data and Image Navigation
   [Expand]Product Information
     ASPxDataView Overview
      Binding to Data
      Data Items
      Layout Modes
      Data Paging
    [Expand]Visual Elements
   [Expand]Image Gallery
   [Expand]Image Slider
   [Expand]Image Zoom
   [Expand]News Control
  [Expand]Multi-Use Site Controls
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Data Items

The ASPxDataView control displays its content in data items that are organized depending on the chosen layout mode. Each data item is the DataViewItem object that is stored in the ASPxDataView.Items collection. The DataViewItem.DataItem property provides access to the content displayed by a particular item.

Expanded Creating Data Items

  • Automatically

    Data items are created automatically when the control is bound to a data source. For each record in the data source, a separate DataViewItem object is created. The DataViewItem.DataItem property is initialized automatically with the corresponding data record values.

  • Manually

    The ASPxDataView.Items collection cannot be popularized declaratively, but you can add data items in code-behind using the DataViewItemCollection.Add method. In this case, a custom data object with the required properties should be assigned to the DataViewItem.DataItem property value.

    Show Me

    A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T358211.

Expanded Displaying Data

The ASPxDataView control organizes and renders its data items depending on the chosen layout mode. The content of an individual data item is displayed in templates. When you bind the ASPxDataView control to a datasource control at design-time, a simple item template is created. Each data field in the data source is displayed with the asp:Label control.

If the default template doesn't serve your purposes, you can create a custom one.

Expanded Creating a Custom Item Template in Markup

Use the ItemTemplate markup section to create a custom item template. Populate the template with data-bound controls and use data binding expressions to associate them with the corresponding data fields. Below is an example of a simple item template.

Expanded Creating a Custom Item Template at Runtime

Create an object implementing the ITemplate interface and assign it to the ASPxDataView.ItemTemplate property value.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T358210.

Is this topic helpful?​​​​​​​