Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Collapse]Image and Data Browsing
   [Expand]Product Information
   [Collapse]DataView
     ASPxDataView Overview
    [Collapse]Concepts
      Binding to Data
      Data Items
      Layout Modes
      Data Paging
    [Expand]Visual Elements
   [Expand]Headline
   [Expand]Image Gallery
   [Expand]Image Slider
   [Expand]Image Zoom
   [Expand]News Control
   [Expand]Pager
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[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.

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