Welcome to the Xceed Community | Help
Community Search  
More Search Options

How To Export Grid Retaining Sort Order

Sort Posts: Previous Next
  •  06-25-2009, 3:28 PM Post no. 22050

    How To Export Grid Retaining Sort Order

    Hello,

    Let's say we have a datagrid with a datatable databound to it, and now we sort by some column in the datagrid (either ascending or descending)... how can I then export my datatable and retain the sort order? I would like to be able to have a popup menu for the grid where the user can export to a CSV file and have it export my datatable not in its default sort order but in the sort order the user set it to.

     Any thoughts?

     Regards,

    Anthony

    Filed under: ,
  •  06-26-2009, 12:38 PM Post no. 22095 in reply to 22050

    Re: How To Export Grid Retaining Sort Order

    Hi Anthony,

    I was not able to reproduce the problem. I ran a few tests and obtained the export in the displayed sort order each time.

      // Test 1
      this.myGrid.ExportToCsv( @"D:\Test1.xls" );

      // Test 2
      this.myGrid.ExportToExcel( @"D:\Test2.xls" );

      // Test 3
      ExcelExporter exporter = new ExcelExporter( this.myGrid );
      exporter.Export( @"D:\Test3.xls" );

    Please make sure you are using the latest version, and if the issue persists please send us a sample project reproducing the problem at support@xceed.com (also include a link to this forum thread for reference).


    Diane Lafontaine
    Technical Support / Technical Support Team Lead
    Xceed Software Inc.
  •  06-26-2009, 1:57 PM Post no. 22098 in reply to 22095

    Re: How To Export Grid Retaining Sort Order

    Hi Diane,

    I'm sorry, I should have used a different example or term other than "export"...  what I meant was, how can I iterate through my underlaying dataset (in this case the datatable) in the *same order* as the sort order set in the datagrid? This way I can do my own custom export using the same sorting that's used in the grid.

    Regards,

    Anthony

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.