I have a gridview with several filtered columns (just generic filters, nothing custom). I want to display the data from the grid in a report and have it respect any filters the user has applied. The initial data is an observablecollection, when the user requests the report I pass the collection (and some additional info) back to my web service and write xml. I think pick up the XML in the report with dataset and bind it, that is all working great. The challenge comes with the filters, I see two ways to approach this:
1) Apply to filters to the collection before sending it to the webservice. This wont work because when the user closes the report viewer, I have it go back to the grid, and if we filtered the collection they wont be able to unfilter it without starting over. Unless maybe I maintain a filtered collection and an unfiltered collection, I just thought of that but I am still not sure how to apply the filters in the first place or how to get at just the data the gridview is showing.
2) Pass the filter info the report and then apply the filters to the dataset which the report picks up.
I have been trying to implement number 2 but I am pretty sure I am going about this in completely the wrong way. What I did is pass in the filter description and then do some string manipulation to so I can do datatable.select. I got this working for the simple "columnname = value" filters but as I am starting to look at all the others (contains, endswith,startswith, etc), I can see that this is going to be way too complex and I am probably reinventing the wheel (and my wheel is a square).
Please show me the light.
1) Apply to filters to the collection before sending it to the webservice. This wont work because when the user closes the report viewer, I have it go back to the grid, and if we filtered the collection they wont be able to unfilter it without starting over. Unless maybe I maintain a filtered collection and an unfiltered collection, I just thought of that but I am still not sure how to apply the filters in the first place or how to get at just the data the gridview is showing.
2) Pass the filter info the report and then apply the filters to the dataset which the report picks up.
I have been trying to implement number 2 but I am pretty sure I am going about this in completely the wrong way. What I did is pass in the filter description and then do some string manipulation to so I can do datatable.select. I got this working for the simple "columnname = value" filters but as I am starting to look at all the others (contains, endswith,startswith, etc), I can see that this is going to be way too complex and I am probably reinventing the wheel (and my wheel is a square).
Please show me the light.