Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
C#
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
C#
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
Updated 6-May-20 1:31am

1 solution

This solution helped me. Add rptviewer.Reset() before setting credentials.
 
Share this answer
 
Comments
tslin89 27-Feb-13 1:59am    
Thanks a lot. It's work now :D
Member 11213630 13-Feb-15 1:50am    
thanks first link and error solved...;)

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