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. Image for the cookie policy date
close icon

Serializing GridGroupingControl

I am currently using WriteXmlSchema to save the current layout of a GridGroupingControl. However, the xml file is also serializing things I would rather not save. Is there any way I can save, say, what is contained in the TableDescriptor element and ignore the other elements such as Appearance, TopLevelGroupOptions, NestedTableGroupOptions, and TableOptions? Thanks

GridGroupingControl_XmlSchema.zip

2 Replies

ST stanleyj Syncfusion Team March 10, 2006 06:32 AM UTC

Hi David, You can Serialize and Deserialize the GridTableDescriptor using System.Xml.Serialization.XmlSerializer to read and write the xml file and hence to store and retrieve information contained in the TableDescriptor alone is possible. // Loading Table Descriptor FileDialog dlg = new OpenFileDialog(); dlg.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*" ; if (dlg.ShowDialog() == DialogResult.OK) { XmlSerializer serializer = new XmlSerializer(typeof(GridTableDescriptor)); XmlReader read = new XmlTextReader(dlg.FileName); GridTableDescriptor gtd = serializer.Deserialize(read) as GridTableDescriptor; this.gridGroupingControl1.TableDescriptor.InitializeFrom(gtd); read.Close(); } // Saving TableDescriptor GridEngine engine = this.gridGroupingControl1.Engine; GridTableDescriptor gtd = engine.TableDescriptor; FileDialog dlg = new SaveFileDialog(); dlg.AddExtension = true; dlg.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*" ; if (dlg.ShowDialog() == DialogResult.OK) { XmlSerializer serializer = new XmlSerializer(typeof(GridTableDescriptor)); XmlTextWriter write = new XmlTextWriter(dlg.FileName, System.Text.Encoding.UTF8); serializer.Serialize(write, gtd); } Best regards, Stanley


DW David Woodstrom March 10, 2006 05:31 PM UTC

Thanks, that worked.

Loader.
Live Chat Icon For mobile
Up arrow icon