Click here to Skip to main content
15,937,004 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using the vs2008 ReportViewer control, and I'd like to filter the date range on the report by selecting it from (2) DatePicker controls. There are a couple of ways to do it I'm sure, but I would like to write the filter as an expression in the reportviewer designer. How can I target a control(s) on my form to filter the expression through?

Please give sample fragment code. I just need this badly..
Posted
Updated 7-Mar-10 23:43pm
v2

Why would you fetch whole lot of data from DB and then apply filter expression on SSRS when you have an option to pass on the date parameters to the query and get back the desired data directly?

Take 2 dates from date control, pass those as query parameters to fetch report data. Display the data (which is based on the 2 dates selected.)
 
Share this answer
 
yap I want that but how to do that pal hehehe
 
Share this answer
 
You can't automatically connect the reportviewer to another control.

You're going to have to edit the actual report to have it accept parameters, pass the parameters into the report, edit the report to use those paramters to narrow down the data in the report, and then reload the report everytime a new date is selected. It would really be better practice, and easier, to do what Sandeep suggested and select the data that falls in that date range and only send that data into the report.

Hope this helps.
 
Share this answer
 
how to do that any fragment code please...
 
Share this answer
 
You can find sample code by searching through code project articles[^] that deal with ReportViewer controls. Or google.[^]
 
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