Dundas Chart for ASP.NET
Save(TextWriter) Method
See Also  Example Send comments on this topic.
Dundas.Charting.WebControl Namespace > ChartSerializer Class > Save Method : Save(TextWriter) Method


writer

An object derived from TextWriter (e.g. StringWriter class) used to save chart properties.


Text writer to save the data.

Saves chart data and properties with non-default values to the given object that is derived from the TextWriter class.


Saves all properties of the chart into the text writer. By setting Content or SerializableContent/NonSerializableContent properties specific set of properties can be saved.

Syntax

Visual Basic (Declaration)  
Public Overloads Sub Save( _
   ByVal writer As TextWriter _
) 
Visual Basic (Usage) Copy Code
Dim instance As ChartSerializer
Dim writer As TextWriter
 
instance.Save(writer)
C#  
public void Save( 
   TextWriter writer
)

Parameters

writer

An object derived from TextWriter (e.g. StringWriter class) used to save chart properties.


Text writer to save the data.

Example

The following example persists the appearance view state at the client. Note that the ViewStateData property represents the actual data persisted in the web document.

Visual Basic Copy Code
Imports System.IOImports Dundas.Charting.Webcontrol
...

' Serialize the view state data
Dim sw As New StringWriter()
Chart1.Serializer.Content = SerializationContent.Appearance
Chart1.Serializer.Save(sw)

' Set the view state data
Chart1.ViewStateData = sw.ToString()
C# Copy Code
using System.IO;
using Dundas.Charting.Webcontrol;
...

// Serialize the view state data
StringWriter sw = new StringWriter();
Chart1.Serializer.Content = SerializationContent.Appearance;
Chart1.Serializer.Save(sw);

// Set the view state data
Chart1.ViewStateData = sw.ToString();

Remarks

By default all chart properties with non-default values (this includes data points) will be serialized when this method is called. To control what chart characteristics are serialized use the ContentSerializableContent and NonSerializableContent properties.

When using this definition the format (set by the Format property) must be XML.

If the ViewStateData property is used to persist state then this method can be used to save the serialized data to an object derived from TextWriter, which is then used to write the data to the ViewStateData property. For more information see the State Management topic (also see the sample code below).

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

Copyright © 2001 - 2009 Dundas Data Visualization, Inc. and others.