Xml or Binary Serialization to Memory Stream

After reading all of the samples and tinkering around with the code, I thought that since the savexml method on the grid control accepted a stream, that I could use a MemoryStream.

I have tried all the combinations I can think of to use MemoryStreams (basically serialize the grid to a string either thru xml or through encoding the binary format)... so I can save it in a column in the db.

Unfortunately, none of the methods seem to work correctly with a memory stream (but do work if you're saving to disk).

Has a) anyone ever successfully used a memorystream to persist a gridcontrol and b) could you please give me a pointer as to how to proceed?

As an aside, I have also tried using the savebinary and loadbinary methods for a cell model, but receive a "Member 'Office2007ScrollBars' was not found" exception when loading from the stream.

HELP :)



1 Reply

AD Administrator Syncfusion Team March 18, 2008 09:41 PM UTC

Hi Chadwick,

Sorry for the delay in response.

If want to save in memory rather than writing to a file system, you can use SaveSoap or SaveBinary method. Please refer the below code that shows how you can save using SaveSoap or SaveBinary method.


MemoryStream s = new MemoryStream();
gridControl1.Model.SaveSoap(s); // or gridControl1.Model.SaveBinary(s);
s.Position = 0;
gridControl1.Model = GridModel.LoadSoap(s);
gridControl2.Model = GridModel.LoadSoap(s);


Please refer the sample in the below link which illustrates the above.
http://websamples.syncfusion.com/samples/Grid.Windows/F72178/main.htm

Thank you for your patience.

Best Regards,
Srirajan



Loader.
Up arrow icon