This is a migrated thread and some comments may be shown as answers.

Passing filters from radgridview to report?

4 Answers 78 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Kjell asked on 20 Aug 2010, 10:48 PM
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.

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 25 Aug 2010, 03:41 PM
Hi Kjell,

In short the answer is that there is no out of the box solution for your scenario. The following forum thread provides more information on how you can proceed: Pass RadGrid DataSource (dataSet)to Telerik Reporting.

Regards,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kjell
Top achievements
Rank 1
answered on 25 Aug 2010, 06:19 PM
I went down the string manipulation road but this is not going to work.  There are too many ways to do the filtering and too many factors to take into account (special characters for instance), not to mention I would still need to figure out a way to dynmically pass in grouping settings as well.

Since the export function respects grouping and filtering settings, is there a way to access that data or piggy back on this process somehow?  Another possible workaround would be if an exported report could just popup after saving, I don't need all the functionality in the viewer but we don't want users to have to save the file and then find and open it.  Is there a way to make the file open like it does when you normally download a file thru the browser?
0
Steve
Telerik team
answered on 27 Aug 2010, 11:44 AM
Hi Kjell,

The following help article elaborates on exporting programmatically: Exporting a report to PDF programmatically. If you remove the Response.AddHeader line, the file should be opened directly in the browser (if you have Acrobat Reader PDF plugin installed and enabled).

Sincerely yours,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kjell
Top achievements
Rank 1
answered on 27 Aug 2010, 05:00 PM
Hi Steve, thanks for the reponse, that article is helpful and interesting but I don't think it addresses my issue. 

The method desribed in that article still would not respect the filters because it's using the reporting engine.  When I said "export", was talking about the grid export, which does respect the filters.  Does that make sense?  Is my understanding correct?

This isn't the end of the world, for now we will just give users the excel and word exports.  We then make them run a new search if they want to see a report, this way we are creating a disconnect between the grid and the report viewer so the user doesn't get confused.  It's not the ideal solution but I think it works for now.
Tags
General Discussions
Asked by
Kjell
Top achievements
Rank 1
Answers by
Steve
Telerik team
Kjell
Top achievements
Rank 1
Share this question
or