This is a migrated thread and some comments may be shown as answers.

'RefreshReport' is not a member of 'ReportViewer'

5 Answers 613 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jorgan
Top achievements
Rank 1
Jorgan asked on 22 Jan 2018, 10:41 PM

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?

 

5 Answers, 1 is accepted

Sort by
0
Jorgan
Top achievements
Rank 1
answered on 23 Jan 2018, 10:17 PM

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>

 

0
Silviya
Telerik team
answered on 25 Jan 2018, 11:46 AM

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
0
John S.
Top achievements
Rank 1
answered on 17 Sep 2018, 04:13 AM

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

 

 

0
Silviya
Telerik team
answered on 19 Sep 2018, 02:14 PM
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
0
John S.
Top achievements
Rank 1
answered on 20 Sep 2018, 01:53 AM

Hi Silviya,

Thanks. Option 1 is what I was looking for.

Best,
John

Tags
General Discussions
Asked by
Jorgan
Top achievements
Rank 1
Answers by
Jorgan
Top achievements
Rank 1
Silviya
Telerik team
John S.
Top achievements
Rank 1
Share this question
or