Back to Devexpress

DataViewItem Class

aspnet-devexpress-dot-web-0aa575d1.md

latest4.4 KB
Original Source

DataViewItem Class

An individual data item in the ASPxDataView control.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public class DataViewItem :
    CollectionItem
vb
Public Class DataViewItem
    Inherits CollectionItem

The following members 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.

aspx
...
<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>
...

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

Implements

IStateManager

IPropertiesOwner

IExpressionsAccessor

Inheritance

Object StateManager CollectionItem DataViewItem ImageGalleryItem

NewsItem

MVCxImageGalleryItem

See Also

DataViewItem Members

Bind Data View to Data

Layout Modes

DataView

DevExpress.Web Namespace