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

Read filtered data on GridGroupingControl

Hi,
I use this component with GridExcelFilter and it works fine.
But i'am not able to to export filtered datas.

If i use the DataSource i export all my data and not the filtered

my sample :
DataView dtv = gridGroupingControl1.DataSource as DataView;
 DataTable dt = dtv.Table;

then i iterate on the datatable to write my XML, can i get a datable "filtered" ?

ps : sorry for english ;-)

6 Replies

RI Rits September 17, 2013 02:39 PM UTC

Any body has a way to perform this ?


VK Vinish Kumar K Syncfusion Team September 18, 2013 05:05 AM UTC

Hi Rits,

 

Thank you for your interest in Syncfusion products,

 

Query

Can’t able to export filter record

We have analysed the reported issue in our end, I am afraid that I am unable to reproduce the reported issue in our end, we can able to export the record to PDF. Please refer the below code which is we have used in sample.

 

private void button1_Click(object sender, EventArgs e)

        {

            GridPDFConverter pdfConvertor = new GridPDFConverter();

 

            pdfConvertor.ExportToPdf("Sample.pdf", this.gridGroupingControl1.TableControl);

            //Launching the PDF file using the default Application.[Acrobat Reader]

            System.Diagnostics.Process.Start("Sample.pdf");

        }

 

 

Please let me know the below details for us.

 

1.       Which version of Syncfusion product you have used currently.

2.       Are you trying to export Grid to PDF, word or Excel

Query

Can I able to get the filtered DataTable in XML

You can get the filtered table in XML using the XML serialization, please refer the below code and sample from the dashboard.

 

private void btnSaveXmlSchema_Click(object sender, System.EventArgs e)

              {

                XmlTextWriter xw = new XmlTextWriter("GridSchema.xml", System.Text.Encoding.UTF8);

                XmlTextWriter xwApp = new XmlTextWriter("GridLooknFeel.xml", System.Text.Encoding.UTF8);

                           xw.Formatting = System.Xml.Formatting.Indented;

                           this.gridGroupingControl1.WriteXmlSchema(xw);

                this.gridGroupingControl1.WriteXmlLookAndFeel(xwApp);

                           xw.Close();

                xwApp.Close();

              }

 

              private void btnLoadXmlSchema_Click(object sender, System.EventArgs e)

              {

            if (File.Exists("GridSchema.xml") && File.Exists("GridLooknFeel.xml"))

            {

                XmlReader xr = new XmlTextReader("GridSchema.xml");

                XmlReader xrApp = new XmlTextReader("GridLooknFeel.xml");

                this.gridGroupingControl1.ApplyXmlSchema(xr);

                this.gridGroupingControl1.ApplyXmlLookAndFeel(xrApp);

                xr.Close();

                xrApp.Close();

            }

            else

                MessageBox.Show("Click \"Save Xml Schema\" button to serialize the grid.");

              }

 

 

Sample path : <install_location>\Syncfusion\EssentialStudio\11.3.0.30\Windows\Grid.Grouping.Windows\Samples\Serialization\XML Serialization Demo\CS

 

Please let me know if you have any issue along with your sample application this will help us to provide proper response asap.

 

Regards,

Vinish k



RI Rits September 23, 2013 01:59 PM UTC

Hi thanks for your response.
I check it, but don't resolve my problem.

What i want, it's very simple (i hope ;-)).

I have a grid with for example with 2 column  -> "Name" and "Sex".
I use the Excel filter on the colum Sex to get only "Male"
the Grid now display only rows with attribute "Male"

And I want to export what i see, so only the rows filtered "Male"
Can i iterate on the Grid to read these data's and then write into a file ('xml, csv etc...)?



VK Vinish Kumar K Syncfusion Team October 4, 2013 03:54 AM UTC

Hi Rits,

 

Thanks for your update.

 

We have analysed the reported query in our end. Currently Syncfusion GridControl support to export the Grid Data to Excel, pdf, word ,csv and HTML format. So you don’t need to iterate the Grid data source, by default these data export only filtered data.

 

For further reference please refer the below samples from your DashBoard.

 

 <Install_Location>\Syncfusion\EssentialStudio\<Version>\Windows\Grid.Windows\Samples\Exporting\Exporting Demo\CS

 

Please refer the below UG link also for further reference,

 

http://help.syncfusion.com/ug/windows%20forms/grid/default.htm#!Documents/135excelexport.htm

 

http://help.syncfusion.com/ug/windows%20forms/grid/default.htm#!Documents/3163excelconverteroptions.htm

 

http://help.syncfusion.com/ug/windows%20forms/grid/default.htm#!Documents/wordconverter.htm

 

http://help.syncfusion.com/ug/windows%20forms/grid/default.htm#!Documents/414103pdfexport.htm

 

http://help.syncfusion.com/ug/windows%20forms/grid/default.htm#!Documents/excelexport1.htm

 

We hope these will resolve / provide required information about your query.

 

Thanks,

Vinish K.



SD Sandesh Daddi August 5, 2015 01:08 PM UTC

Did you get the answer for this question?

What I want is, list of filtered records from GridGroupingControl. 

I want to create an excel with custom formatting, like My company logo at the Top left, then Report title below that and then all the filtered data from the grid. 

Is it possible by any means?

Thank you,
Sandesh D


AK Adhikesevan Kothandaraman Syncfusion Team August 6, 2015 08:58 AM UTC

Hi Sandesh,

Thank you for your interest in Syncfusion products.

In order to get the filtered records from the grid, you can use the FilteredRecords property. In this collection, the records which are all filtered for particular scenario are maintained. Please make use of below code,

Code Snippet:

FilteredRecordsInTableCollection filteredRecords = this.gridGroupingControl1.Table.FilteredRecords;

Sample:
 http://www.syncfusion.com/downloads/support/directtrac/142357/ze/Filtering-142357856009

Please let me know if you have any concerns.

Regards,
Adhi.


Loader.
Live Chat Icon For mobile
Up arrow icon