dashboard-devexpress-dot-dashboardweb-dot-idashboardstorage-dot-loaddashboard-x28-system-dot-string-x29.md
Loads the dashboard with the specified identifier from the current IDashboardStorage.
Namespace : DevExpress.DashboardWeb
Assembly : DevExpress.Dashboard.v25.2.Web.dll
NuGet Package : DevExpress.Web.Dashboard.Common
XDocument LoadDashboard(
string dashboardID
)
Function LoadDashboard(
dashboardID As String
) As XDocument
| Name | Type | Description |
|---|---|---|
| dashboardID | String |
A String value that specifies the dashboard identifier.
|
| Type | Description |
|---|---|
| XDocument |
A XDocument object that is the XML definition of the loaded dashboard.
|
Implement the IDashboardStorage.SaveDashboard method to save the dashboard to the current IDashboardStorage.
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:
View Example: ASP.NET CoreView Example: ASP.NET MVCView Example: ASP.NET Web Forms
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.
mvc-dashboard-download-dashboard-xml-definition/CS/Controllers/HomeController.cs#L30
}
XDocument xdoc = st.LoadDashboard(dashboardId);
MemoryStream stream = new MemoryStream();
See Also