Skip to main content

DataViewItemCollection.Add() Method

Adds a new item to the end of the collection.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web


public DataViewItem Add()


Type Description

A DataViewItem object that has been added to the collection.


This method creates a new DataViewItem object, initializes it with default settings and appends it to the collection.

Use the Add method to add data items in code-behind. In this case, a custom data object with the required properties should be assigned to the DataViewItem.DataItem property value.

using DevExpress.Web;
    const int itemsCount = 10;
    protected void DataView_Load(object sender, System.EventArgs e) {
        DataView.ItemTemplate = new MyDataViewTemplate();
    void AddDataItems(ASPxDataView dataView) {
        for (int i = 1; i <= itemsCount; i++) {
            dataView.Items.Add().DataItem = new {
                ID = i,
                Name = "Name" + i,
                Description = "Sample description for the item"
See Also