How to programatically close a ReportViewer with NO records?

2 posts, 0 answers
  1. Rob Ainscough
    Rob Ainscough avatar
    260 posts
    Member since:
    Jan 2010

    Posted 27 Feb 2015 Link to this post

    We've stumbled on a show stopper problem (as we can't use Telerik Reporting as a solution) where we can't close a Telerik Report programatically if there are no records returned.  We're using the Telerik process where a web service is assigned to the ReportViewer and that web service contains a single line:

    <%@ ServiceHost Service="Telerik.Reporting.Service.ReportService, Telerik.Reporting.Service, Version=, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" %>

    We're unable to recover any return information (i.e. RecordCount = 0) that would allow us to issue a Me.Close on the Report Child Window that contains the ReportViewer control.  In fact, there is NO web service handler we can use i.e. a "Completed" handler to be able to get any type of return information.

    Is this just a limitation of Telerik Reporting and hence we need to explore alternative products, or is there some method we're missing that will help us accomplish our application requirements?

    Thanks, Rob.
  2. Stef
    Stef avatar
    3610 posts

    Posted 03 Mar 2015 Link to this post

    Hello Rob,

    Your colleague posted the same question through our support ticketing system. below is quote from my response in the ticket:
    "Reports only visualize data, where data-binding can be done only on the server. Reports and their data are processed entirely on the server and only the rendered document is returned to the client. Thus the client has no information about the amount of records until the report document is delivered, processed with its settings (filters, groupings and others affecting the visualized data) and assigned set of records.

    Using the ReportViewer API exposed as of Telerik Reporting Q3 2014, you can determine when the report rendering ends and take action. Note that even empty, the report will have at least one blank page, allowing you to display a custom message in the report (respectively the viewer).

    If your requirements are to not display a viewer if there is no data, you will have to implement a method evaluating the data that will be used by reports. Based on it result you can decide whether to display a viewer.

    We requested additional details about the scenario. Please let us continue the discussion in the support ticket where we can freely exchange files.

    Thank you for your understanding.


    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