Serialization

Hi I''m evaluating GridGroupingControl. I manage to group dates, to filter them and to serialize them in an XML format. As I noticed, when serializing, the table or sql on which grid is filled, it is not saved in the XML file. I''ve tried to use TableDescriptor.Name property it''s ok for data that are not grouped, but when I group data after a column, the TableDescriptor.Name proprety is changed to "Default" value. Please give me an example about how to serialize the source of GridGroupingControl togheter with the rest of the data. Thanks

1 Reply

AD Administrator Syncfusion Team August 13, 2004 11:22 AM UTC

Hi Christi, check out the CategoryView example. You can modify its SaveSchema and LoadSchema methods to also save and load the dataset. private void btnSaveXmlSchema_Click(object sender, System.EventArgs e) { FileDialog dlg = new SaveFileDialog(); dlg.AddExtension = true; dlg.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*" ; if (dlg.ShowDialog() == DialogResult.OK) { XmlTextWriter xw = new XmlTextWriter(dlg.FileName, System.Text.Encoding.UTF8); this.gridGroupingControl1.WriteXmlSchema(xw); xw.Close(); this.dataSet11.WriteXml("NWCategories.xml", XmlWriteMode.WriteSchema); } } private void btnLoadXmlSchema_Click(object sender, System.EventArgs e) { FileDialog dlg = new OpenFileDialog(); dlg.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*" ; if (dlg.ShowDialog() == DialogResult.OK) { XmlReader xr = new XmlTextReader(dlg.FileName); ApplySchema(xr, Path.GetFileName(dlg.FileName), "Engine Schema (" + Path.GetFileName(dlg.FileName) + ")"); xr.Close(); this.dataSet11 = new DataSet1(); ReadXml(this.dataSet11, "NWCategories.xml"); this.gridGroupingControl1.DataSource = this.dataSet11.Categories; this.gridGroupingControl1.DataMember = null; } } void ApplySchema(XmlReader xr, string info, string undoDescription) { GridEngine engine = GridEngine.CreateFromXml(xr); if (engine != null) this.gridGroupingControl1.Engine.InitializeFrom(engine); } I attached a modified form1.cs file. Form1_4970.zip Stefan

Loader.
Up arrow icon