Click here to Skip to main content
15,888,301 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using an export utility to to export the contents of a datagrid in csv format.

When the page loads the grids load all data. The grids have datapagers.

When the user filter's, I want to be able to export the data using a click event.

I have a grid in the background that I am loading on the click event then exporting the contents but I'm still not getting all of the data.

How can I reload the domain datasource, then export all of the filtered results?

The following code is still only returning a portion of the data even though it's a larger set than the paged data.

Contract_Profile2DomainDataSource.Load() 
    ExpGrid.ItemsSource = Contract_Profile2DomainDataSource.Data 
    Export(dg:=ExpGrid)
Posted
Updated 19-Oct-10 9:07am
v2
Comments
HimanshuJoshi 19-Oct-10 15:07pm    
Edited for code-block

1 solution

It took me a while to work through this solution and to resolve the problem I did the following:

1. Configured the datagrid autoload to false
2. In the XAML, configured domain datasource load size to maximum allowed. I have many datagrids in the particular application so the maximum load size varied according to size of the database tables.
3. Configured the Domain Datasource's maximum items in the Object Graph
<pre lang="xml"><behavior name="DomainService">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="655360" />
        </behavior>


4. Eliminated page size in the data pager
5. Enabled an apply filter button that nicely takes the user's input through a number of controls and populates the datagrids.

My export buttons works perfectly now and the user can save all of the rows in the items source in csv or excel.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900