The requested page is not available for the requested platform. You are viewing the content for Default platform.

DashboardDesigner.DataLoading Event

Allows you to provide data for the DashboardObjectDataSource.

Namespace: DevExpress.DashboardWin

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


public event DataLoadingEventHandler DataLoading
Public Event DataLoading As DataLoadingEventHandler

Event Data

The DataLoading event handler receives an argument of the DataLoadingEventArgs type. 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.


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 DashboardDesigner.ConfigureDataConnection event to customize connection parameters.


This example demonstrates how to use the DashboardDesigner.DataLoading event to load the data from XML file at runtime.

It contains a dashboard bound to an object data source with fake data whose structure is defined by an XML schema. The actual data is loaded at runtime from an XML file.

To load the data, click the Load Data custom button in the dashboard title. The button is created by handling the CustomizeDashboardTitle event. Its click action calls the DashboardViewer.ReloadData method that triggers the DashboardViewer.DataLoading event. The actual data is obtained within the event handler and assigned to the e.Data property.

Imports System
Imports System.Data
Imports DevExpress.XtraEditors
Imports DevExpress.DashboardCommon

Namespace Dashboard_DataLoading
    Partial Public Class Form1
        Inherits XtraForm

        Public Sub New()
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
            Dim dashboard As New Dashboard()
            Dim objectDataSource As New DashboardObjectDataSource()
            objectDataSource.DataSource = GetData()
            dashboardViewer1.Dashboard = dashboard

            ' Creates a new grid dashboard item with two columns that display car models and prices.
            Dim grid1 As New GridDashboardItem()
            grid1.DataSource = dashboard.DataSources(0)
            grid1.Columns.Add(New GridDimensionColumn(New Dimension("Model")))
            grid1.Columns.Add(New GridMeasureColumn(New Measure("Price")))
        End Sub

        ' Handles the DashboardViewer.DataLoading event to provide the dashboard with new data.
        Private Sub dashboardViewer1_DataLoading(ByVal sender As Object, _
                                                 ByVal e As DataLoadingEventArgs) _
                                             Handles dashboardViewer1.DataLoading
            If e.DataSourceName = "Object Data Source 1" Then
                e.Data = UpdateData()
            End If
        End Sub

        Public Function GetData() As DataTable
            Dim xmlDataSet As New DataSet()
            Return xmlDataSet.Tables("Cars")
        End Function

        Public Function UpdateData() As DataTable
            Dim xmlDataSet As New DataSet()
            Return xmlDataSet.Tables("Cars")
        End Function

        Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
            ' Reloads data in data sources.
        End Sub
    End Class
End Namespace
See Also