Tab
A newer version of this page is available. Switch to the current version.

DataViewItem Class

An individual data item in the ASPxDataView control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

public class DataViewItem :
    CollectionItem
Public Class DataViewItem
    Inherits CollectionItem

Related API Members

The following members accept/return DataViewItem objects:

Remarks

The ASPxDataView control supports standard data binding. Any object which implements the IEnumerable or IDataSource interface (e.g., SqlDataSource, XmlDataSource) may be used as a data source for this control. Each data record from the underlying data source becomes the DataViewItem. To access the data item to which the data view item is bound, use the DataViewItem.DataItem property.

Instances of the DataViewItem class are stored in a collection of the DataViewItemCollection type, which can be accessed through the ASPxDataView control's ASPxDataView.Items property.

Individual data item layouts can be customized using the ASPxDataView.ItemTemplate. 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.


...
<ItemTemplate>
    <table>
        <tr>
            <td>
                <dx:ASPxLabel ID="lblName" runat="server" Text='<%# Eval("Name") %>' Font-Bold="true" />
            </td>
            <td>
                <dx:ASPxImage ID="imgIcon" runat="server" ImageUrl='<%# Eval("ImageUrl") %>' ShowLoadingImage="true" />
            </td>
        </tr>
        <tr>
            <td>
                <dx:ASPxLabel ID="lblDescription" runat="server" Text='<%# Eval("Description") %>' />
            </td>
        </tr>
    </table>
</ItemTemplate>
...

ASPxDataView DataBound ItemTemplate

Data items can be organized in a table view or flow one after another depending on the chosen layout mode.

See Also