Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET SSRS
Hello!,
I am having a problem when viewing nested SSRS report from ASP.Net web form.
I have two projects, one for SSRS and another one for ASP.Net.
 
In SSRS project, I have two report files (Summary.rdl, Details.rdl)
Summary.rdl show report data in single line, for eg. Code, Name, Description, Remark.
"Code" filed from summary column have an action "Go to report" - Details.rdl to show selected line of record in details.
 
In ASP.Net project, I have a web form that contains -
1. some report criteria controls,
2. Microsoft.Reporting.WebForms.ReportViewer control inside a panel (let's say panel1)
3. button with the name "btnPreview" to see report. (show Panel)
4. button with the name "btnBack" to hide report and choose criteria. (hide Panel)
 
When I click preview, it will show "Summary.rdl" with desired criteria. It's work fine. I change some report criteria and click preview again, it's still working as expected.
 
Error occur only when,
1. Click preview button.
2. Click on the column "Code" and see details report (Details report shows correctly)
3. Close the report. (just hide the panel)
4. Click preview button again. Then, I got an exception "Operation is not valid due to the current state of the object".
 
Remark: If I don't click on the link from summary report, everything goes fine.
 
This is what inside btnPreview click.
pnlRptViewer.Visible = true;
rptviewer.ServerReport.ReportServerCredentials = new ReportServerNetworkCredential();
rptviewer.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["RSURL"].ToString());
rptviewer.ServerReport.ReportPath = mReportConfiguration.mReportInfo.mReportPath;
rptviewer.ServerReport.GetDataSources(out allCredentialsSet);
rptviewer.ServerReport.SetParameters(aReportParamsCollection);
 
rptviewer.ServerReport.Refresh();
 
This is what inside btnBack click
pnlRptViewer.Visible = false;
 
Error occur when initializing ReportServerCredentials.
I think something was changed on report server when I click a link on summary report. But I don't know what's going wrong.
Please help. And let me know if there is any other information that I need to provide.
 
Thanks in advance.
Posted 6-Jan-13 16:11pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This solution helped me. Add rptviewer.Reset() before setting credentials.
  Permalink  
Comments
TSLin306 at 27-Feb-13 1:59am
   
Thanks a lot. It's work now :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid