IDashboardStorage.LoadDashboard(String) Method
Loads the dashboard with the specified identifier from the current IDashboardStorage.
Namespace: DevExpress.DashboardWeb
Assembly: DevExpress.Dashboard.v24.1.Web.dll
NuGet Package: DevExpress.Web.Dashboard.Common
Declaration
Parameters
Name | Type | Description |
---|---|---|
dashboardID | String | A String value that specifies the dashboard identifier. |
Returns
Type | Description |
---|---|
XDocument | A XDocument object that is the XML definition of the loaded dashboard. |
Remarks
Implement the IDashboardStorage.SaveDashboard method to save the dashboard to the current IDashboardStorage.
Example
This example shows how to create custom dashboard storage in an ASP.NET Core application and to store dashboards in a database. The LoadDashboard
method is used to load a dashboard with the specified ID in XDocument format from storage.
public XDocument LoadDashboard(string dashboardID) {
using (SqlConnection connection = new SqlConnection(connectionString)) {
connection.Open();
SqlCommand GetCommand = new SqlCommand("SELECT Dashboard FROM Dashboards WHERE ID=@ID");
GetCommand.Parameters.Add("ID", SqlDbType.Int).Value = Convert.ToInt32(dashboardID);
GetCommand.Connection = connection;
SqlDataReader reader = GetCommand.ExecuteReader();
reader.Read();
byte[] data = reader.GetValue(0) as byte[];
MemoryStream stream = new MemoryStream(data);
connection.Close();
return XDocument.Load(stream);
}
}
The following examples are based on different platforms and show how to create a custom dashboard storage to load and save dashboards to a database:
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the LoadDashboard(String) method.
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.