save and restore grid state
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: save and restore grid state

  1. #1
    Join Date
    Jul 2011
    Posts
    2

    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

  2. #2
    Join Date
    Jul 2011
    Posts
    9

    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.dapfor.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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center