'RefreshReport' is not a member of 'ReportViewer'

6 posts, 0 answers
  1. Jorgan
    Jorgan avatar
    2 posts
    Member since:
    Jan 2018

    Posted 22 Jan 2018 Link to this post

    I'm currently running into a road block, I'm the only user at the company figuring out if Telerik will work for our reports.

    When following.....https://docs.telerik.com/reporting/quick-start-windows-viewer

    I get

    'RefreshReport' is not a member of 'ReportViewer' telerik telerik report on adding the RefreshReport() on step 8 while running this in Visual Basic.

    ======================Code Sample Bellow====================

    Imports Telerik.ReportViewer
    Imports Telerik.Reporting.Report
    Imports Telerik.Reporting
    Imports Telerik.ReportViewer.Html5

    Public Class WebForm1
        Inherits System.Web.UI.Page

        Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.ReportViewer1.RefreshReport()
        End Sub

    End Class

    =========================================

    I added the imports to see if that would help and it has not.   Have a missed something obvious?

     

  2. Jorgan
    Jorgan avatar
    2 posts
    Member since:
    Jan 2018

    Posted 23 Jan 2018 in reply to Jorgan Link to this post

    I believe the reportviewer.refreshreport is not necessary when you use a webform application.  

    I have removed this and now the print preview and export do go to pdf but the report does not display in the print preview.

    Here is the code form the aspx for the webform

     

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication1.WebForm1" %>

    <%@ Register assembly="Telerik.ReportViewer.Html5.WebForms, Version=12.0.18.117, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" namespace="Telerik.ReportViewer.Html5.WebForms" tagprefix="telerik" %>


    <html xmlns="http://www.w3.org/1999/xhtml">

    <head runat="server">
        <title>Telerik HTML5 Web Forms Report Viewer Demo</title>
        <script src="Scripts/jquery-3.3.1.js"></script>
        <%--<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>--%>
        <script src="http://kendo.cdn.telerik.com/2015.3.930/js/kendo.all.min.js"></script>

        <script src="Scripts/themeSwitcher.js"></script>

        <link href="http://kendo.cdn.telerik.com/2015.3.930/styles/kendo.common.min.css" rel="stylesheet" id="commonCss" />
        <link href="http://kendo.cdn.telerik.com/2015.3.930/styles/kendo.blueopal.min.css" rel="stylesheet" id="skinCss" />

        <style>
            body {
                margin: 5px;
                font-family: Verdana, Arial;
            }

            #reportViewer1 {
                position: absolute;
                left: 5px;
                right: -280px;
                top: 40px;
                bottom: -340px;
                overflow: hidden;
                clear: both;
            }

            #theme-switcher {
                float: right;
                width: 12em;
                height: 30px;
            }
        </style>

        <script type="text/javascript">
            $(document).ready(function () {
                //Theme switcher
                themeSwitcher(
                    '#theme-switcher',
                    '#commonCss',
                    '#skinCss');
            });
        </script>
    </head>
    <body>
    <form runat="server">
    <select id="theme-switcher"></select>
            <h1>Report</h1>
            <div style ="overflow:hidden; height:2000px;">
                <telerik:ReportViewer ID="ReportViewer1" runat="server" Width="100%" Height="100%">
                    <ReportSource 
                        Identifier="ReportLibrary1.Report2, ReportLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" 
                        IdentifierType="TypeReportSource">
                    </ReportSource>
                </telerik:ReportViewer>

            </div>
        </form>
    </body>
    </html>

     

  3. Silviya
    Admin
    Silviya avatar
    414 posts

    Posted 25 Jan 2018 Link to this post

    Hello Jorgan,

    Setting the viewer's ReportSource will refresh the viewer:

    Dim clientReportSource As New Telerik.ReportViewer.Html5.WebForms.ReportSource
    clientReportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.TypeReportSource
    clientReportSource.Identifier = GetType(ReportCatalog).AssemblyQualifiedName 'or <namespace>.<class>, <assembly> e.g. "MyReports.Report1, MyReportsLibrary"
    clientReportSource.Parameters.Add("Parameter1", 123)
    reportViewer1.ReportSource = clientReportSource

    In case you need to refresh manually, this can be done from the client side using a refreshReport() method of the viewer's widget. To get the ReportViewer object from the HTML element you can use the following JavaScript code:
    var reportViewer = $("#reportViewer1").data("telerik_ReportViewer");

    Report can be previewed in Interactive mode and Print preview mode in the report viewer - Interactive vs. Print Layout. Switching between those two modes is done through the viewer's toolbar. 
    Send us some screen shots that demonstrate the problematic behavior in print preview so we can understand the scenario more clearly.


    Regards, Silviya
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  4. John S.
    John S. avatar
    103 posts
    Member since:
    Aug 2004

    Posted 16 Sep 2018 in reply to Silviya Link to this post

    Hello Silviya,

    I have a test report I am working on that configures and displays the report viewer correctly using your code above on Page Load during not a post back.

    I also have a button that has similar code but changes a parameter. When I press that the reportviewer disappears

    Page Load:

    Dim clientReportSource As New Telerik.ReportViewer.Html5.WebForms.ReportSource
            clientReportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.TypeReportSource
            clientReportSource.Identifier = GetType(TrainingComplianceReports.rptAncrFindingsChart).AssemblyQualifiedName 'or <namespace>.<class>, <assembly> e.g. "MyReports.Report1, MyReportsLibrary"
            clientReportSource.Parameters.Add("ClientName", "Hello")
            ReportViewer1.ReportSource = clientReportSource

     

    With button

    Dim clientReportSource As New Telerik.ReportViewer.Html5.WebForms.ReportSource
            clientReportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.TypeReportSource
            clientReportSource.Identifier = GetType(TrainingComplianceReports.rptAncrFindingsChart).AssemblyQualifiedName 'or <namespace>.<class>, <assembly> e.g. "MyReports.Report1, MyReportsLibrary"
            clientReportSource.Parameters.Add("ClientName", "Hi")
            ReportViewer1.ReportSource = clientReportSource

     

    What am I missing here?

     

    Thanks,

    John

     

     

  5. Silviya
    Admin
    Silviya avatar
    414 posts

    Posted 19 Sep 2018 Link to this post

    Hi John,

    The WebForms wrapper of the HTML5 Viewer renders a DIV element with the ID of the viewer, a Javascript object in the page (the script for creating the viewer object) at the bottom of the page.

    Thus when you try to reload report viewer's report source on button click, not the whole page is updated and the scripts for creating the viewer object are not triggered - the result is the missing content from the DIV element with the ID of the viewer.

    To resolver the issue you can:
    1. Update the viewer object's reportSource at the client instead of posting the information to the server. For the purpose you can use the reportSource method. an example of such update is illustrated in How To: Pass Values to Report Parameters.
    2. Make a full post-back where the page will be reloaded entirely.

    Regards,
    Silviya
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. John S.
    John S. avatar
    103 posts
    Member since:
    Aug 2004

    Posted 19 Sep 2018 in reply to Silviya Link to this post

    Hi Silviya,

    Thanks. Option 1 is what I was looking for.

    Best,
    John

Back to Top