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.
Unfortunately, activation email could not send to your email. Please try again.

Serialize filtered datatable in XML

Thread ID:

Created:

Updated:

Platform:

Replies:

46772 Jul 20,2006 05:50 AM Jul 24,2006 06:48 AM General Discussion 4
loading
Tags: General Discussion
Karsten Brocksieper
Asked On July 20, 2006 05:50 AM

Hello,

even if I know that there is a special forum for the GGC I want to ask my question in this forum because I think that it´s a general question.

I use the Filterbar feature in a GGC and need to serialize the filtered data in XML with the WriteXML method of the datatable object in the following way.

Try
Dim xw As New XmlTextWriter("c:\temp\apoInventarListe.xml", System.Text.Encoding.UTF8)
xw.Formatting = Formatting.Indented
Dim dt As DataTable = Me.grdgrpXLImport.DataSource
dt.WriteXml(xw, XmlWriteMode.WriteSchema)
xw.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

But as a result of this code I always get the complete datatable and not only the filtered rows from the GGC.

Can anyone help me to serialize only the filtered rows of a datatable.

Thank you very much
Karsten

Administrator [Syncfusion]
Replied On July 21, 2006 08:39 AM

Hi Karsten,

Please refer the forum thread for Serialize grouping table descriptor.
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=41724

You can Save the GridEngine changes to xml using the Engine.WriteXml method and intialize GridEngine from Xml using CreateFromXml method. Here is a code snippet.

// intialize GridEngine from Xml
System.IO.FileStream file = new FileStream("XML11.xml",FileMode.Open);
System.Xml.XmlTextReader xr = new System.Xml.XmlTextReader(file);
GridEngine engine = GridEngine.CreateFromXml(xr);
this.gridGroupingControl1.Engine.InitializeFrom(engine);
xr.Close();

//GridEngine changes to xml
System.IO.FileStream file = new FileStream("XML11.xml",FileMode.OpenOrCreate);
System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(file,System.Text.Encoding.UTF8 );
this.gridGroupingControl1.Engine.WriteXml( writer);
writer.Close();

Best regards,
Haneef

Karsten Brocksieper
Replied On July 21, 2006 02:09 PM

Hi Haneef,

thank you for your answer but unfortunately your suggestion is not the solution in my case.

With your suggested code and the link I can serialize the schema of the grid but not the data itself.

For example: I have a GGC with about 50 items in the datasource of the grid. Now I filter with the filterbar method and as a result there are at least only 10 items in the grid.

My problem is now that -with my code- I ALWAYS get 50 items in my XML file regardless of the filter settings.

What I want to do is just getting the filtered resultset in my serialized XML file and not all of the data from my underlying datatable.

It would be really helpful for me if you can help me.

Thank you in advance
Regards, Karsten

Karsten Brocksieper
Replied On July 22, 2006 06:58 AM

Hi,

in the meantime I have found that the visible (=filtered) records are in the FilteredRecords collection (Me.GridGrouping.Table.FilteredRecords). But actually I´m having the problem that I can´t get this collection in a DataTable object.

Can anyone help me with this?

Regards, Karsten

Administrator [Syncfusion]
Replied On July 24, 2006 06:48 AM

Hi Karsten,

Please refer the forum thread for more details.
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=32614

Let me know if this helps.
Best Regards,
Haneef

CONFIRMATION

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.

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.

;