Serialize / Deserialize

Hi


how can you write to the table
  dt1.Columns.Add ("Deserialize", typeof (string));
so that after pressing "Serialize" you can save to dt1 DataTable ("serialize");

and after pressing "Deserialize" the contents of dt1 DataTable ("serialize") were read;
and set gridGroupingControl1.WriteXmlSchema

yes, eliminate (if possible) the need to save the GridSchema.xml file to disk


Attachment: GGC_FILTR_903d708e.rar

13 Replies

AR Arulpriya Ramalingam Syncfusion Team March 17, 2020 05:31 AM UTC

Hi Gregory, 
 
Greetings from Syncfusion. 
 
We already have provided a knowledge base document to serialize/deserialize the different types of information in GridGroupingControl. Please make use of the KB in which the ConditionalFormattingCollection is saved and reused. The type of DataSource property can be used to implement the workaround for DataTable of GridGroupingControl.  
 
 
Please get back to us, if you have any other queries. 
 
Regards, 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam March 17, 2020 09:27 AM UTC

Hi Gregory, 
 
Greetings from Syncfusion. 
 
We already have provided a knowledge base document to serialize/deserialize the different types of information in GridGroupingControl. Please make use of the KB in which the ConditionalFormattingCollection is saved and reused. The type of DataSource property can be used to implement the workaround for DataTable of GridGroupingControl.  
 
 
Please get back to us, if you have any other queries. 
 
Regards, 
Arulpriya 


Hi Arulpriya ,
thank you for the answer but

1.

I need to save the GGC "serialize" settings to the database table in the form of an XML document in the Deserialize column ", typeof (string)
dsT002.Tables ["serialize"]. Rows [0] ["Deserialize"] = XML_serialize_GGC;//"GridSchema.xml"

2
then read from the base from Deserialize ", typeof (string) and set" Deserialize "GGC
  XML_serialize_GGC = dsT002.Tables ["serialize"]. Rows [0] ["Deserialize"]//"GridSchema.xml"

Regards,
Gregory


PM Piruthiviraj Malaimelraj Syncfusion Team March 18, 2020 12:27 PM UTC

Hi Gregory, 

Thanks for your update. 

We suspect that your requirement is to get the content of serialized (xml) file and store in in data table. If so, you can get the xml content by using XmlDocument.InnerXml and save it in data table like below code snippet. 
XmlDocument doc = new XmlDocument(); 
doc.Load("ConditionalSchema.xml"); 
 
string xmlString = doc.InnerXml; 
 
dt_serialize.Rows[0]["Deserialize"] = xmlString; 

Please provide more details about your exact requirements, if we misunderstood anything. 

Regards, 
Piruthiviraj 



GP Gregory Pe March 18, 2020 12:30 PM UTC

Hi Arulpriya

thank you very much

Regards,
Gregory


BR Backia Raj Kanagaraj Syncfusion Team March 19, 2020 11:30 AM UTC

Hi  Gregory, 

Thanks for your update. 

Please get back to us, if you have any other queries. 

Regards, 
Backia Raj Kanagaraj 



GP Gregory Pe October 7, 2020 04:45 PM UTC

Hi

is it possible to perform serialization in the option without selected parameters
e.g. omitting parameters
1.SerializedImageArray
2.ShowButtons
so that it does not serialize these parameters


//Stream stream = new MemoryStream();
                //XmlTextWriter xw9 = new XmlTextWriter("GridSchema.xml", System.Text.Encoding.UTF8);
                //xw9.Formatting = System.Xml.Formatting.Indented;
                //this.M_ORDER_LINE_OPER_gridGroupingControl.WriteXmlSchema(xw9);
                //xw9.Close();





Regards,
Gregory


AR Arulpriya Ramalingam Syncfusion Team October 8, 2020 06:06 PM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We could not understand your reported requirement with the provided details. So, please confirm us that whether you are trying to serilize the data from GridColumnDescriptorCollection and need to remove the ShowButtons property of the columns while serializing. If yes, the serialization for a class will take backup for all the properties in the class and we regret to let you know that the reported scenario is not possible. If not, please provide more details about your exact requirement which will help us to assist you further. 
 
Regards, 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam October 8, 2020 06:18 PM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We could not understand your reported requirement with the provided details. So, please confirm us that whether you are trying to serilize the data from GridColumnDescriptorCollection and need to remove the ShowButtons property of the columns while serializing. If yes, the serialization for a class will take backup for all the properties in the class and we regret to let you know that the reported scenario is not possible. If not, please provide more details about your exact requirement which will help us to assist you further. 
 
Regards, 
Arulpriya 


Hi Arulpriya


I save the xml file to the sql database

it takes a lot of space

I need to reduce the size at least by removing the SerializedImageArray column


Regards,
Gregory


AR Arulpriya Ramalingam Syncfusion Team October 9, 2020 06:04 PM UTC

Hi Gregory,

Thank you for the update.

To remove the ConditionalFormat or a ColumnDescriptor while serializing it, we would suggest that you to remove the column in the collection. Please make use of the below code example for further details.

Example code
//To serialize the GridConditionalFormatDescriptor to  XML file
GridConditionalFormatDescriptorCollection collection = this.gridGroupingControl1.TableDescriptor.ConditionalFormats;
collection.Remove("column name");
XmlSerializer xmlSerializer = new XmlSerializer(typeof(GridConditionalFormatDescriptorCollection));
XmlWriter writer = XmlWriter.Create("ConditionalSchema.xml");
//Serialize the specified ConditionalFormat write the XML document.xmlSerializer.Serialize(writer, collection);


please get back to us if you need any further assistance.

Regards,
Arulpriya



GP Gregory Pe replied to Arulpriya Ramalingam October 10, 2020 09:48 AM UTC

Hi Gregory,

Thank you for the update.

To remove the ConditionalFormat or a ColumnDescriptor while serializing it, we would suggest that you to remove the column in the collection. Please make use of the below code example for further details.

Example code
//To serialize the GridConditionalFormatDescriptor to  XML file
GridConditionalFormatDescriptorCollection collection = this.gridGroupingControl1.TableDescriptor.ConditionalFormats;
collection.Remove("column name");
XmlSerializer xmlSerializer = new XmlSerializer(typeof(GridConditionalFormatDescriptorCollection));
XmlWriter writer = XmlWriter.Create("ConditionalSchema.xml");
//Serialize the specified ConditionalFormat write the XML document.xmlSerializer.Serialize(writer, collection);


please get back to us if you need any further assistance.

Regards,
Arulpriya


Hi Arulpriya
I have created  Serialize1_button_Click and  De_serialize_button

after executing serialize1_button_Click
the content of the xml file is still there 
collection.Remove("SerializedImageArray");


<?xml version="1.0" encoding="utf-8"?>
<GridEngine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <IsDynamicData>false</IsDynamicData>
  <OptimizeIListGroupingPerformance>false</OptimizeIListGroupingPerformance>
  <GroupDropArea>true</GroupDropArea>
  <TableDescriptor>
    <SortedColumns>
      <SortColumnDescriptor>
        <Name>CategoryID</Name>
        <SortDirection>Ascending</SortDirection>
      </SortColumnDescriptor>
    </SortedColumns>
    <Columns>
      <GridColumnDescriptor>
        <Width>60</Width>
        <MappingName>CategoryName</MappingName>
        <AllowFilter>true</AllowFilter>
      </GridColumnDescriptor>
      <GridColumnDescriptor>
        <Width>60</Width>
        <MappingName>Description</MappingName>
        <AllowFilter>true</AllowFilter>
      </GridColumnDescriptor>
      <GridColumnDescriptor>
        <SerializedImageArray>iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAK7wAACu8BfXaKSAAAACt0RVh0Q3JlYXRpb24gVGltZQBEaSAxNiBEZXogMjAwMyAxNzowNDoyNiArMDEwMGA2Le4AAAAHdElNRQfTAwYRESBP5iuyAAACPElEQVQ4T62RTW8SURSGb/z4DcpG3enOxJX+ATeNca3GrYldtAqkgSoTm5DQhaFNS00c2jTEErCxodZCg4RIDQ0FawqkBpEvmQwftZUUSspQYF7vwHXR6IJF3+Rm7pw5z3vmnENOVRz35ZzXKzxwuVKeQCBf2djIy4FAWl5djVfm5nzu6Wn3/fX1j2dZ+kmlUrgWDP6OieIR/qd6HdjaKoLnP0Qdjk9XGdZTOHx0ZXOzsstyIctAQ+qA3JoHuTmPSgXY3weKRaBQAGZn35ctFvslhhPi8QhL7XYPVp5/797IbvegBZTLgCAA6TSQywEc93KR4YSEQuWmAnQ6gCQBzQatWD1GPFeDeSWHNu1KFIFsFkgkeneLxSkxnJBIhNpTNanN4SE1ocDDmR+4MBjG5acRgL7n8wCdE3Z2ekY8/05mOCFra99Fpe9aDahW6cCoiSLyOAYyGKUBCmV61WMxoFQCRkbGogwnxG7/+iSVOuj+gWLSoGevKoPoBZBRAbmSjBztXamuDNLp9Mk6nWGA4YSMj78443J9syUSe12TFq14d/kYKl7CRb6BgcUmMrR6MgmEw1loNDoTQ0/K5Yo/WljwF0LBDH79lNCiq6srq6PV47QTZQZW69uO0TimYsi/8vk8563W5dtTU284k2nmtVptcDidn7G9DWQybWi1o26W2p80GoPKZlvprm5iwipx3PPr7FN/4jjjsN+fxOTkfFOvf3aPhfuT2fzqjlarF4eGNEtq9fANFj5NEfIHIFPpp8NrhfsAAAAASUVORK5CYII=</SerializedImageArray>
        <Width>162</Width>
        <MappingName>CategoryID</MappingName>
        <AllowFilter>true</AllowFilter>
      </GridColumnDescriptor>
      <GridColumnDescriptor>
        <Width>15</Width>
        <MappingName>SampleData</MappingName>
        <AllowFilter>true</AllowFilter>
      </GridColumnDescriptor>
    </Columns>
    <ConditionalFormats>
      <GridConditionalFormatDescriptor>
        <Rules />
        <Expression>[CategoryID] &lt; 30</Expression>
        <Name>ConditionalFormat 1</Name>
        <Appearance>
          <AnyRecordFieldCell>
            <Interior>Solid; 255, 191, 52</Interior>
            <TextColor>White</TextColor>
          </AnyRecordFieldCell>
        </Appearance>
      </GridConditionalFormatDescriptor>
      <GridConditionalFormatDescriptor>
        <Rules />
        <Expression>[CategoryID] &gt; 70</Expression>
        <Name>ConditionalFormat 2</Name>
        <Appearance>
          <AnyRecordFieldCell>
            <Interior>Solid; 102, 110, 152</Interior>
            <TextColor>White</TextColor>
          </AnyRecordFieldCell>
        </Appearance>
      </GridConditionalFormatDescriptor>
    </ConditionalFormats>
  </TableDescriptor>
  <TopLevelGroupOptions>
    <ShowAddNewRecordBeforeDetails>false</ShowAddNewRecordBeforeDetails>
    <ShowCaption>true</ShowCaption>
    <ShowFilterBar>true</ShowFilterBar>
  </TopLevelGroupOptions>
</GridEngine>

does not remove "SerializedImageArray"
I'm doing something wrong

Regards,
Gregory






Attachment: CS1_4c997d58.rar


AR Arulpriya Ramalingam Syncfusion Team October 12, 2020 06:29 PM UTC

Hi Gregory, 
Thank you for the update. 
We could understand the scenario that the GridGroupingControl does not have column descriptor for SerializedImageArray but it is generated in the xml file while serializing it. We have forwarded the query to our development team for further analysis and we will update you with proper details on 14th October 2020. 
Regards, 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam November 25, 2020 10:08 AM UTC

Hi Gregory, 
Thank you for the update. 
We could understand the scenario that the GridGroupingControl does not have column descriptor for SerializedImageArray but it is generated in the xml file while serializing it. We have forwarded the query to our development team for further analysis and we will update you with proper details on 14th October 2020. 
Regards, 
Arulpriya 


Hi
whether something was done in the topic

Regards,
Gregory


AR Arulpriya Ramalingam Syncfusion Team November 26, 2020 05:19 PM UTC

Hi Gregory,

Sorry for the inconvenience.

We are facing some difficulties to find the root cause of the reported scenario and we need some more time to validate further. We will update you the proper details on 02nd December 2020.

Regards,
Arulpriya


Loader.
Up arrow icon