Change report path in ReportViewer control

L

Larry Bud

I have a reportviewer control. I programmatically set the local
report path based on a drop down on a page. This allows the user to
choose which format (RDLC file) to use when generating the report.

The first request, the report processes properly, however if I choose
a different report format, the old report still renders. I'm doing
a .refresh for the report...

I tried turning off Viewstate for the report, but it says that
Viewstate must be true for the ReportViewer control.

If I "reenter" the page as new (such as by clicking on my menu item
for that page), it will then run the first report type chosen.

I'm changing the local report path such as

ReportViewer1.LocalReport.ReportPath = "myreport1.rdlc"
or
ReportViewer1.LocalReport.ReportPath = "myreport2.rdlc"

Any ideas?
 
L

Larry Bud

I have a reportviewer control. I programmatically set the local
report path based on a drop down on a page. This allows the user to
choose which format (RDLC file) to use when generating the report.

The first request, the report processes properly, however if I choose
a different report format, the old report still renders. I'm doing
a .refresh for the report...

I tried turning off Viewstate for the report, but it says that
Viewstate must be true for the ReportViewer control.

If I "reenter" the page as new (such as by clicking on my menu item
for that page), it will then run the first report type chosen.

I'm changing the local report path such as

ReportViewer1.LocalReport.ReportPath = "myreport1.rdlc"
or
ReportViewer1.LocalReport.ReportPath = "myreport2.rdlc"

Any ideas?

It never fails that I ALWAYS find the answer to my question 10 minutes
after I post...

Must do a

ReportViewer1.LocalReport.Reset()

first. Then set your reportpaths, then do a
ReportViewer1.LocalReport.Refresh()

You must have VS2005 SP1 for this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top