2

I have a web page where there are anchor tags for report names. On click of report name (anchor tag), I have ajax call which passes report URL to the backend method. In that method, I am providing credentials for accessing the report and showing report as a partial view. Below is the code:

public ActionResult Report(string rptPath)
        {
            ReportViewer rptViewer = new ReportViewer();
            rptViewer.ProcessingMode = ProcessingMode.Remote;
            rptViewer.SizeToReportContent = true;
            rptViewer.ZoomMode = ZoomMode.PageWidth;
            rptViewer.Width = Unit.Percentage(100);
            rptViewer.Height = Unit.Percentage(1000);
            rptViewer.AsyncRendering = true;
            rptViewer.ServerReport.ReportServerUrl = new Uri(xxxx);

            rptViewer.ServerReport.ReportPath = rptPath;
            IReportServerCredentials irsc = new CustomReportCredentials(uname, pword, domain);
            rptViewer.ServerReport.ReportServerCredentials = irsc;

            ViewBag.ReportViewer = rptViewer;
            return PartialView("Report");
        }

I am getting The report parameter 'ReportParameter1' is read-only and cannot be modified. (rsReadOnlyReportParameter) error. This is an internal parameter having a default value and I don't want to change it to Visible or Hidden. Is there any option to solve this issue using the c# code?

V.Mulik
  • 119
  • 1
  • 4
  • 17
  • Internal parameters can be tricky. We always use Hidden which can be then passed in the report or being called from another report. here is a good discussion about internal parameters https://stackoverflow.com/questions/9844357/what-are-the-rules-for-using-internal-parameters-in-ssrs – Pepys Nov 08 '18 at 11:21
  • Thanks. I want to know the root cause of this issue. Because when I use Iframe and below code to render the report, it works fine. 'iframe.src = "http://reportserver/Pages/ReportViewerWebForm.aspx?" + reportpath + "&rs:Command=Render";' – V.Mulik Nov 08 '18 at 11:29
  • 1
    Is there any value is getting passed to readonly parameter? How can I prevent passing the value to readonly parameter? – V.Mulik Nov 15 '18 at 06:44

1 Answers1

0

I was getting this error from an ASP.NET web app, and what initially worked for me was deleting and re-creating the parameter. Thankfully, deleting the parameter will not automatically delete references to it in your report, so as long as you delete and replace the parameter with the same name, then you should be good. That said, in my case, I then also had to edit the report directly via SSRS to ensure that there were "prompts" that could be targeted/filled by my back-end code. One or both of those steps should solve this.

enter image description here