dashboard-devexpress-dot-dashboardcommon-dot-dataloadingeventargs-9d925c31.md
Gets an object data source’s unique identifier.
Namespace : DevExpress.DashboardCommon
Assembly : DevExpress.Dashboard.v25.2.Core.dll
NuGet Package : DevExpress.Dashboard.Core
public string DataId { get; }
Public ReadOnly Property DataId As String
| Type | Description |
|---|---|
| String |
An object data source’s identifier.
|
Use the DataId property to identify the data source for which the event is raised.
This example shows how to bind the ASP.NET MVC Dashboard extension to the Object Data Source and use the DashboardConfigurator.DataLoading event to supply the data source with data:
using System.Web.Routing;
using DevExpress.DashboardWeb;
using DevExpress.DashboardWeb.Mvc;
using DevExpress.DashboardCommon;
namespace DashboardMVC {
public static class DashboardConfig {
public static void RegisterService(RouteCollection routes) {
routes.MapDashboardRoute("dashboardControl");
DashboardFileStorage dashboardFileStorage = new DashboardFileStorage("~/App_Data/Dashboards");
DashboardConfigurator.Default.SetDashboardStorage(dashboardFileStorage);
DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();
// Registers an Object data source.
DashboardObjectDataSource objDataSource = new DashboardObjectDataSource("Object Data Source");
objDataSource.DataId = "Object Data Source ID";
dataSourceStorage.RegisterDataSource("objDataSource", objDataSource.SaveToXml());
DashboardConfigurator.Default.SetDataSourceStorage(dataSourceStorage);
DashboardConfigurator.Default.DataLoading += DataLoading;
}
private static void DataLoading(object sender, DataLoadingWebEventArgs e) {
if(e.DataId == "Object Data Source ID") {
e.Data = Invoices.CreateData();
}
}
}
}
Imports System.Web.Routing
Imports DevExpress.DashboardWeb
Imports DevExpress.DashboardWeb.Mvc
Imports DevExpress.DashboardCommon
Namespace DashboardMVC
Public Module DashboardConfig
Public Sub RegisterService(ByVal routes As RouteCollection)
routes.MapDashboardRoute("dashboardControl")
Dim dashboardFileStorage As New DashboardFileStorage("~/App_Data/Dashboards")
DashboardConfigurator.Default.SetDashboardStorage(dashboardFileStorage)
Dim dataSourceStorage As New DataSourceInMemoryStorage()
' Registers an Object data source.
Dim objDataSource As New DashboardObjectDataSource("Object Data Source")
objDataSource.DataId = "Object Data Source ID"
dataSourceStorage.RegisterDataSource("objDataSource", objDataSource.SaveToXml())
DashboardConfigurator.Default.SetDataSourceStorage(dataSourceStorage)
AddHandler DashboardConfigurator.Default.DataLoading, AddressOf DataLoading
End Sub
Private Sub DataLoading(ByVal sender As Object, ByVal e As DataLoadingWebEventArgs)
If e.DataId = "Object Data Source ID" Then
e.Data = Invoices.CreateData()
End If
End Sub
End Module
End Namespace
The following code snippets (auto-collected from DevExpress Examples) contain references to the DataId property.
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.
winforms-dashboard-window-function-calc-field/CS/DesignerForm1.cs#L16
private void DashboardDesigner1_DataLoading(object sender, DataLoadingEventArgs e) {
if (e.DataId == "odsSales") {
e.Data = ProductSales.GetProductSales();
asp-net-core-dashboard-custom-item-gallery/CS/AspNetCoreCustomItem/Startup.cs#L80
private void Configurator_DataLoading(object sender, DataLoadingWebEventArgs e) {
if (e.DataId == "odsTaskData") {
DataSet dataSet = new DataSet();
DashboardDifferentUserDataAspNetCore/CS/Code/MultiTenantDashboardConfigurator.cs#L41
if (e.DataId == "odsSales") {
if (userName == "Admin") {
configurator.DataLoading += (s, e) => {
if (e.DataId == "employees") {
e.Data = Employee.Employees;
dashboard-blazor-server-localization/CS/BlazorDashboardApp/Code/DashboardUtils.cs#L17
configurator.DataLoading += (s, e) => {
if (e.DataId == "employees") {
e.Data = Employee.Employees;
winforms-dashboard-window-function-calc-field/VB/DesignerForm1.vb#L18
Private Sub DashboardDesigner1_DataLoading(ByVal sender As Object, ByVal e As DataLoadingEventArgs) Handles dashboardDesigner.DataLoading
If e.DataId = "odsSales" Then
e.Data = ProductSales.GetProductSales()
web-forms-dashboard-save-dashboards-title-as-file-name/VB/DXWebApplication2/Default.aspx.vb#L37
Protected Sub DataLoading(ByVal sender As Object, ByVal e As DataLoadingWebEventArgs)
If Equals(e.DataId, "Object Data Source Data Id") Then
e.Data = Invoices.CreateData()
aspnet-mvc-dashboard-data-federation/VB/MVC_DataFederationExample/App_Start/DashboardConfig.vb#L70
Private Shared Sub DataLoading(ByVal sender As Object, ByVal e As DataLoadingWebEventArgs)
If e.DataId = "odsInvoices" Then
e.Data = Invoices.CreateData()
Private Sub ASPxDashboardObjectDS_DataLoading(ByVal sender As Object, ByVal e As DataLoadingWebEventArgs)
If Equals(e.DataId, "objectDataSource") Then
e.Data = Invoices.CreateData()
Private Shared Sub DataLoading(ByVal sender As Object, ByVal e As DataLoadingWebEventArgs)
If e.DataId = "objectDataSource" Then
e.Data = Invoices.CreateData()
See Also