Skip to main content
Tab

DataViewItem.DataItem Property

Gets or sets the data item that is bound to the Item.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

public object DataItem { get; set; }

Property Value

Type Description
Object

A Object that represents the data item which is bound to the item.

Remarks

Use the DataViewItemCollection.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 DataItem property value.

using DevExpress.Web;
    const int itemsCount = 10;
    protected void DataView_Load(object sender, System.EventArgs e) {
        AddDataItems(DataView);
        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