Our scenario is as follows:
We have a web page that acts as a generic report container. The web page is passed a numeric ReportID which it uses to look up the file name of a tdrx file which it subsequently loads into the viewer as a URIReportSource. This gives us the ability to modify our reports without having to publish a new binary to the web server.
We would like for our report container page to be able to turn off the visibility of certain parameters, however no matter which ReportViewer event we capture (we tried them all), the Report property of the viewer is always blank, so we have no programmatic access to the parameter collection of the report object. All of the examples we have found of hiding report parameters use compiled reports rather than URI report sources and the methodologies applied do not work in our usage scenario.
How do we programmatically hide parameters for a URIReportSource-based report?
We are running version 7.0.13.228 of the web report viewer.
We have a web page that acts as a generic report container. The web page is passed a numeric ReportID which it uses to look up the file name of a tdrx file which it subsequently loads into the viewer as a URIReportSource. This gives us the ability to modify our reports without having to publish a new binary to the web server.
We would like for our report container page to be able to turn off the visibility of certain parameters, however no matter which ReportViewer event we capture (we tried them all), the Report property of the viewer is always blank, so we have no programmatic access to the parameter collection of the report object. All of the examples we have found of hiding report parameters use compiled reports rather than URI report sources and the methodologies applied do not work in our usage scenario.
How do we programmatically hide parameters for a URIReportSource-based report?
We are running version 7.0.13.228 of the web report viewer.
9 Answers, 1 is accepted
0

Al
Top achievements
Rank 1
answered on 11 Dec 2013, 10:58 PM
UPDATE:
We found a way to do this.
Just in case anyone else needs to do this we found that the Telerik.Reporting.XmlSerialization.ReportXMLSerializer is our new best friend. We simply use the deserializer to give us a Telerik.Reporting.Report object which we can play with to our heart's content and then create an Telerik.Reporting.InstanceReportSource and set its ReportDocument property to the report the deserializer kicked out, and then set the report viewer's ReportSource property to our InstanceReportSource and we were able to accomplish what we want to do. Here is the code in VB.NET
We found a way to do this.
Just in case anyone else needs to do this we found that the Telerik.Reporting.XmlSerialization.ReportXMLSerializer is our new best friend. We simply use the deserializer to give us a Telerik.Reporting.Report object which we can play with to our heart's content and then create an Telerik.Reporting.InstanceReportSource and set its ReportDocument property to the report the deserializer kicked out, and then set the report viewer's ReportSource property to our InstanceReportSource and we were able to accomplish what we want to do. Here is the code in VB.NET
Dim MyReportFile As String = "MyReport.trdx"
Dim streamreader As New StreamReader(
MyReportFile
)
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
Dim MyReport As Telerik.Reporting.Report = DirectCast(xmlSerializer.Deserialize(streamreader), Telerik.Reporting.Report)
With MyReport.ReportParameters
.Item("Param1").Visible = false
End With
Dim instanceReportSource As New Telerik.Reporting.InstanceReportSource()
instanceReportSource.ReportDocument =
MyReport
Me.ReportViewer1.ReportSource = instanceReportSource
0

Jules
Top achievements
Rank 1
answered on 29 Oct 2014, 09:42 PM
I've implemented this solution, but I just updated to Q3 2014 and now I'm getting the following error: "'Telerik.ReportViewer.Wpf.ReportViewerModel' is inaccessible due to its protection level." Is there a new way to do this?
0
Hi Jules,
By design the ReportViewerModel usage was for internal usage and it was not recommended to use it, as it could affect the way the viewer operates and even break it. As of Q3 2014 the model was hidden and its functionality is exposed through the WPF ReportViewer control - ReportViewer Members.
I you need further help, please elaborate on the reason why and how you use the ReportViewerModel.
Regards,
Stef
Telerik
By design the ReportViewerModel usage was for internal usage and it was not recommended to use it, as it could affect the way the viewer operates and even break it. As of Q3 2014 the model was hidden and its functionality is exposed through the WPF ReportViewer control - ReportViewer Members.
I you need further help, please elaborate on the reason why and how you use the ReportViewerModel.
Regards,
Stef
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

Jules
Top achievements
Rank 1
answered on 03 Nov 2014, 02:36 PM
It's exactly as used in this thread. I use the ReportViewerModel as described here, to hide the parameters area of a WPF report viewer because my UI provides this functionality in a way that's consistent with the rest of the user experience.
0
Hello Julia,
By using the ReportViewer instead of the ReportViewerModel you can simply set the ParametersAreaVisible property to false, which will hide the parameters area:
Please also note that you can set the visibility of all your parameters to false, in which case the parameters area will not be displayed at all.
Additionally please note that any other functionality provided by the ReportViewerModel is now exposed through the ReportViewer.
Regards,
IvanY
Telerik
By using the ReportViewer instead of the ReportViewerModel you can simply set the ParametersAreaVisible property to false, which will hide the parameters area:
reportViewer1.ParametersAreaVisible =
false
;
Please also note that you can set the visibility of all your parameters to false, in which case the parameters area will not be displayed at all.
Additionally please note that any other functionality provided by the ReportViewerModel is now exposed through the ReportViewer.
Regards,
IvanY
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

Jorge
Top achievements
Rank 2
answered on 10 Dec 2014, 01:49 AM
Hi,
We also had it implemented by using the ReportViewModel, we also used the command:
".MoveToPreviousPageCommand.Execute(null);"
and I can't find a replacement for it on the ReportViewer.
Can you lend me a hande here?
BR
Jorge
We also had it implemented by using the ReportViewModel, we also used the command:
".MoveToPreviousPageCommand.Execute(null);"
and I can't find a replacement for it on the ReportViewer.
Can you lend me a hande here?
BR
Jorge
0

Jorge
Top achievements
Rank 2
answered on 10 Dec 2014, 01:53 AM
Hi
We were also using the ReportViewModel specifically to navigate pages programatically by using
.MoveToPreviousPageCommand.Execute(null);
.MoveToNextPageCommand.Execute(null);
But now I can't seem to find the replacements in ReportViewer
Any hints?
BR
Jorge
We were also using the ReportViewModel specifically to navigate pages programatically by using
.MoveToPreviousPageCommand.Execute(null);
.MoveToNextPageCommand.Execute(null);
But now I can't seem to find the replacements in ReportViewer
Any hints?
BR
Jorge
0

Jorge
Top achievements
Rank 2
answered on 10 Dec 2014, 11:13 AM
We were also using the ReportViewModel specifically to navigate pages programatically by using
.MoveToPreviousPageCommand.Execute(null);
.MoveToNextPageCommand.Execute(null);
But now I can't seem to find the replacements in ReportViewer, I've placed a ticket also, but maybe can help out here in the forums.
Any hints?
BR
0
Hi Jorge,
Below is quote from my response in your support ticket on the same question:
"Please check the updated API of the WPF ReportViewer control - ReportViewer Members. You can use the NavigateBack and NavigateForward methods."
If you need further help, please use your support ticket to send us more details.
Regards,
Stef
Telerik
Below is quote from my response in your support ticket on the same question:
"Please check the updated API of the WPF ReportViewer control - ReportViewer Members. You can use the NavigateBack and NavigateForward methods."
If you need further help, please use your support ticket to send us more details.
Regards,
Stef
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.