We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

serializing a GridModel used as part of a datastructure

Thread ID:





104474 Jul 22,2012 10:29 AM UTC Aug 2,2012 12:35 PM UTC WinForms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On July 22, 2012 10:29 AM UTC

In the attached example I use a GridModel as a scratchpad structure. Unless I have copied values
into this GridModel, I am unable to save and load the data structure successfully. Is there a way to
do so? In the real app, the GridModel may be empty because there are a lot of preliminary steps
which the user must complete before reaching the step where the scratchpad is used. This could
take days or weeks. Hence, saving at intermediate stages becomes a necessity.


Kalaiarasan B [Syncfusion]
Replied On July 30, 2012 07:10 AM UTC

Hi Jan,

 Thank you for your interest in Syncfusion products.

 You can serialize the GridModel directly to binary format using the SaveBinary() and so you can use the following way to achieve the desired behavior instead of serializing using BinaryFormatter and Stream.

 // Serialize

if (dr == System.Windows.Forms.DialogResult.OK)


                dataStructure.Textbox1Text = textBox1.Text;

                dataStructure.Textbox2Text = textBox2.Text;





if (dr == System.Windows.Forms.DialogResult.OK)


                this.gridControl1.Model = GridModel.LoadBinary(openFileDlg.FileName);


                textBox1.Text = dataStructure.Textbox1Text;

                textBox2.Text = dataStructure.Textbox2Text;


 Sample for your reference


 Please let us know if you have any concerns



Administrator [Syncfusion]
Replied On July 30, 2012 10:09 PM UTC

Your approach saves the grid model but does not save the data structure. I wish to save a data structure, one element of which is a grid model, as a single file. Using your approach would require saving the data structure as 2 files (1 file for the 'non-grid' data elements and another for the grid model).

Kalaiarasan B [Syncfusion]
Replied On August 2, 2012 12:35 PM UTC

Hi Jan,

Hi Jan,

It is not possible to save the GridModel like in your sample, only LoadBinary, LoadSoap can serialize the GridModel without any null refernce exceptions. 

So it would be better if you serialize the Grid and the datastructure in the previous approach.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon