Skip to main content
A newer version of this page is available. .

DashboardViewer.DataLoading Event

Allows you to provide data for the DashboardObjectDataSource.

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v19.1.Win.dll

Declaration

public event DataLoadingEventHandler DataLoading

Event Data

The DataLoading event's data class is DataLoadingEventArgs. The following properties provide information specific to this event:

Property Description
Data Gets or sets data for the current data source.
DataSourceComponentName Get the component name of the data source for which the event has been raised.
DataSourceName Gets the name of the data source for which the event has been raised.
Parameters Provides access to parameter values passed to the object data source.

Remarks

The DataLoading event is raised when the dashboard needs to load data from a data source assigned using the DashboardObjectDataSource. Use the event parameter’s DataLoadingEventArgs.Data property to provide data for this data source. This object should implement the IEnumerable or IListSource interface.

For other data source types (for instance, DashboardSqlDataSource or DashboardOlapDataSource), you can handle the DashboardViewer.ConfigureDataConnection event to customize connection parameters.

Example

The following example demonstrates how to bind a dashboard to a List object.

In this example, information about the sold units quantity is provided at runtime. The dashboard data source is added to the Dashboard.DataSources collection on the first load.

To update the displayed data, the DashboardViewer.ReloadData method is called. This raises the DashboardViewer.DataLoading event and allows supplying the dashboard with updated data.

using System;
using System.Collections.Generic;
using System.Threading;

namespace Dashboard_BindingToList {
    public class Data {
        public string SalesPerson { get; set; }
        public int Quantity { get; set; }

        public static List<Data> CreateData() {
            List<Data> data = new List<Data>();
            string[] salesPersons = { "Andrew Fuller", "Michael Suyama", "Robert King", "Nancy Davolio",
                "Margaret Peacock", "Laura Callahan", "Steven Buchanan", "Janet Leverling" };

            for (int i = 0; i < 100; i++) {
                Data record = new Data();
                int seed = (int)DateTime.Now.Ticks & 0x0000FFFF;
                record.SalesPerson = salesPersons[new Random(seed).Next(0, salesPersons.Length)];
                record.Quantity = new Random(seed).Next(0, 100);
                data.Add(record);
                Thread.Sleep(3);
            }
            return data;
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataLoading event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also