Hiding report parameters

10 posts, 0 answers
  1. Al
    Al avatar
    3 posts
    Member since:
    Feb 2013

    Posted 11 Dec 2013 Link to this post

    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.
  2. Al
    Al avatar
    3 posts
    Member since:
    Feb 2013

    Posted 11 Dec 2013 Link to this post

    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

    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

  3. Jules
    Jules avatar
    20 posts
    Member since:
    Jul 2005

    Posted 29 Oct 2014 Link to this post

    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?
  4. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 03 Nov 2014 Link to this post

    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
     

    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.

     
  5. Jules
    Jules avatar
    20 posts
    Member since:
    Jul 2005

    Posted 03 Nov 2014 in reply to Stef Link to this post

    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.
  6. IvanY
    Admin
    IvanY avatar
    417 posts

    Posted 04 Nov 2014 Link to this post

    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:
    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.

     
  7. Jorge
    Jorge avatar
    6 posts
    Member since:
    Apr 2013

    Posted 09 Dec 2014 in reply to IvanY Link to this post

    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
  8. Jorge
    Jorge avatar
    6 posts
    Member since:
    Apr 2013

    Posted 09 Dec 2014 in reply to IvanY Link to this post

    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
  9. Jorge
    Jorge avatar
    6 posts
    Member since:
    Apr 2013

    Posted 10 Dec 2014 Link to this post



    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
  10. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 11 Dec 2014 Link to this post

    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
     

    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.

     
Back to Top