ASPxDiagram.Import(String) Method
Imports the diagram data.
Namespace: DevExpress.Web.ASPxDiagram
Assembly: DevExpress.Web.ASPxDiagram.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Parameters
Name | Type | Description |
---|---|---|
data | String | The diagram data in JSON format. |
Remarks
The Export() method allows you to save information about the diagram’s layout, appearance, and shape positions.
Use the Import method to load this data to the ASPxDiagram control.
<dx:ASPxDiagram ID="Diagram" runat="server" Width="100%" Height="600px"/>
<dx:ASPxButton ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click"/>
<dx:ASPxButton ID="btnLoad" runat="server" Text="Load" OnClick="btnLoad_Click" />
using System.IO;
...
protected void btnSave_Click(object sender, EventArgs e) {
using (StreamWriter diagramData = File.CreateText(MapPath(diagramDataPath))) {
diagramData.WriteLine(Diagram.Export());
}
}
protected void btnLoad_Click(object sender, EventArgs e) {
Diagram.Import(File.ReadAllText(MapPath(diagramDataPath)));
}
Use the ASPxClientDiagram.Export and ASPxClientDiagram.Import methods to save and load the diagram data on the client side.
Note
The ASPxDiagram stores an opened diagram’s data in its own text format. Do not modify the data the Export method returns because a modified document can be loaded incorrectly.
See Also