-
April 4th, 2012, 07:41 AM
#1
save and restore grid state
Hello all
I want to know is it possible to save and restore the grid's state in any way.
Any way means with any method.
Thanks
-
April 4th, 2012, 07:50 AM
#2
Re: save and restore grid state
According to me, You have to use binary data serialization method to save and restore the grid's state.You can get detailed explanation of this on http://www.******.com/en/net-suite/n...-serialization
a litle part of code is here
//The method serializes the grid's state into the XML file
void XmlSerialization(Grid grid, string fileName)
{
using(FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write))
{
XmlSerializer serializer = new XmlSerializer(typeof(Grid.GridSerializationState));
serializer.Serialize(fs, grid.SerializationState);
}
}
//The method deserializes the grid's state from the XML file
void XmlDeserialization(Grid grid, string fileName)
{
using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read))
{
XmlSerializer serializer = new XmlSerializer(typeof(Grid.GridSerializationState));
grid.SerializationState = (Grid.GridSerializationState) serializer.Deserialize(fs);
}
}
Last edited by robertalis; April 4th, 2012 at 07:55 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|