9 Answers, 1 is accepted
I have created the report Formando.vb in my App_Code folder. It has a parameter named ID. In my other page I have a ReportViewer1 were in the properties I selected the report (Formando, App_Code.qswomq_6, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null). Now I want to do something like this: when i open my page, I want that to pass to the report the query string. I tried this:
|Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load|
|ReportViewer1.Report.ReportParameters(0).Value = Request.QueryString("ID")|
But it isn't working. Is there another way? thanks again
Before getting to your question, we would recommend separating your reports in a class library project. The Web Site project has some limitations which will prevent you from using the tool fully. You can review the provided documentation for more info on creating reports in a class library project.
Now to your question - we do not find any problems in the code snippet you have sent that would cause any issues. However, it is not clear what is the exact problem you have encountered and what is expected to happen. Please, examine all the reporting examples especially ProductLineSales where you can find how to use report parameters. Also have in mind that we're continue working on them as currently report parameters have limited application.
We would also highly recommend reviewing the documentation and support videos as they hold valuable information on using the Reporting tool.
the Telerik team
I found a way. :))
Maybe the problem is the next piece of code: ReportViewer1.Report.ReportParameters(0) . Before setting the Report parameter you should add it to the ReportParameters collection
the Telerik team
Here is what I did to make it work...
- at the Report Properties window, set a parameter (in my case I called it County) -- select the report by clicking the upper left corner block on the designer then when you select parameter from the properties, you will need to add a new one and give it a name and a default value -- so if the page gets called without a querystring, it will still run.
- Now go to the SQL Data Adapter (if you used this item to grab and utilize a stored procedure or just a select statement) and go to the properties and under parameter put in something like
- Now go to the report viewer. My Report Viewer is named RVPollBook
Go to View Code and add these lines to the Page_Load event
If Request.QueryString("county") IsNot Nothing Then
RVPollBook.Report.ReportParameters(0).Value = Request.QueryString("county")
Now when I pass in something like PollBookv.aspx?county=22 I get all the items with a county number of 22.... yea!