Skip to main content

ASPxClientReportViewer Class

A legacy client-side control that is the equivalent of the ASPxClientDocumentViewer control’s ReportViewer. Use the ASPxClientWebDocumentViewer instead.

Declaration

declare class ASPxClientReportViewer extends ASPxClientControl

Remarks

To access an ASPxClientReportViewer, call the ASPxClientDocumentViewer.GetViewer method.

Inheritance

See Also

Methods

Cast(obj) Method

Converts the specified object to the current object’s type. This method is effective when you utilize the Client API IntelliSense feature provided by DevExpress.

Declaration

static Cast(
    obj: any
): ASPxClientReportViewer

Parameters

Name Type Description
obj any

The client object to be type cast. Represents an instance of a DevExpress web control’s client object.

Returns

Type Description
ASPxClientReportViewer

An object of the ASPxClientReportViewer type. Represents the converted client object specified by the obj parameter.

Remarks

The Cast method is implemented as a part of the JavaScript IntelliSense support for DevExpress ASP.NET controls and MVC extensions. So, using the Cast method is sensible when you intend to use IntelliSense during writing JavaScript code at design time with the help of the DevExpress client API.

A call to the Cast method (which is a static method) casts the specified client object to the ASPxClientReportViewer type. As a result, the object’s type is now known and ASPxClientReportViewer type specific IntelliSense information can be displayed for this client object, facilitating your coding.

The examples of this method application are as follows.

  • Converting the event source object passed to a client event’s handler:

    ...
    <ClientSideEvents Init="function(s, e) { 
        var clientObject = ASPxClientReportViewer.Cast(s);
    }" />
    
  • Converting a client object accessed by using the value of the ClientInstanceName (or ID) property. For instance, if a web control’s ClientInstanceName property is set to ‘ASPxClientReportViewer1’, the object can be type cast in the following manner:

    ...
    var clientObject = ASPxClientReportViewer.Cast('ASPxClientReportViewer1');
    

GotoPage(pageIndex) Method

Displays a report page with the specified page index in the ReportViewer.

Declaration

GotoPage(
    pageIndex: number
): void

Parameters

Name Type Description
pageIndex number

An integer value which specifies the index of a page to be displayed.

IsSearchAllowed Method

Gets a value indicating whether or not searching text across a report is permitted in the web browser.

Declaration

IsSearchAllowed(): boolean

Returns

Type Description
boolean

true, if searching text in the report is allowed; otherwise, false.

Print Method

Prints a report page with the specified page index.

Declaration

Print(
    pageIndex?: number
): void

Parameters

Name Type Description
pageIndex number

An integer value which specifies an index of the page to be printed.

Remarks

After calling this method, depending on the ReportViewer.PrintUsingAdobePlugIn property’s value, a report page is printed in either of the following two ways:

  • Using a Web Browser’s printing capabilities. This means that the Web Browser’s printer settings will be used to print a report.
  • Using the Adobe® Reader plug-in.
See Also

Refresh Method

Initiates a round trip to the server so that the current page will be reloaded.

Declaration

Refresh(): void

SaveToDisk(format) Method

Exports a report to a file of the specified format, and saves it to the disk.

Declaration

SaveToDisk(
    format: string
): void

Parameters

Name Type Description
format string

A string specifying the format, to which a report should be exported.

Remarks

The following export formats can be used as a format parameter passed to the SaveToDisk method:

  • “pdf”
  • “xls”
  • “xlsx”
  • “csv”
  • “rtf”
  • “mht”
  • “txt”
  • “bmp”
  • “png”
  • “jpg”
  • “gif”
  • “tiff”

SaveToWindow(format) Method

Exports a report to a file of the specified format, and shows it in a new Web Browser window.

Declaration

SaveToWindow(
    format: string
): void

Parameters

Name Type Description
format string

A string specifying the format, to which a report should be exported.

Remarks

The following export formats can be used as a format parameter passed to the SaveToWindow method:

  • “pdf”
  • “xls”
  • “xlsx”
  • “csv”
  • “rtf”
  • “mht”
  • “txt”
  • “bmp”
  • “png”
  • “jpg”
  • “gif”
  • “tiff”

Invokes the Search dialog, which allows end-users to search for specific text in a report.

Declaration

Search(): void

Remarks

Note that the Search dialog can be invoked only if the ASPxClientReportViewer.IsSearchAllowed method returns true.

SubmitParameters(parameters) Method

Submits the values of the specified parameters.

Declaration

SubmitParameters(parameters: { [key: string]: any; }): void

Parameters

Name Type Description
parameters {[key: string]: any}

A dictionary containing the parameter names, along with their Object values.

Events

BeginCallback Event

Occurs when a callback for server-side processing is initiated.

Declaration

BeginCallback: ASPxClientEvent<ASPxClientBeginCallbackEventHandler<ASPxClientReportViewer>>

Event Data

The BeginCallback event's data class is ASPxClientBeginCallbackEventArgs. The following properties provide information specific to this event:

Property Description
command Gets a command name that identifies which client action initiated a callback.

Remarks

The BeginCallback and ASPxClientReportViewer.EndCallback events can be used to perform specific client-side actions when a callback is being processed on a server.

See Also

CallbackError Event

Fires on the client if any server error occurs during server-side processing of a callback sent by ASPxClientReportViewer.

Declaration

CallbackError: ASPxClientEvent<ASPxClientCallbackErrorEventHandler<ASPxClientReportViewer>>

Event Data

The CallbackError event's data class is ASPxClientCallbackErrorEventArgs. The following properties provide information specific to this event:

Property Description
handled Gets or sets whether the event is handled and the default error handling actions are not required.
message Gets the error message that describes the server error that occurred.

Remarks

The CallbackError event enables you to properly respond to a server error occurring as a result of a callback being processed on the server side. Handle this event to perform specific client-side actions, such as displaying explanatory text or an image related to the error.

Typically, a server error which occurs during server-side processing of a callback, leads to web application hanging, because, in this case, no proper response is generated for a control that initiated the callback. However, AJAX-enabled web controls from the DevExpress product line are able to automatically catch server errors occurring within handlers of their server-side events, and to pass the related error information to the client for further processing through the CallbackError event’s argument.

To learn more, see the Handling Callback Exceptions on Client topic.

See Also

EndCallback Event

Occurs on the client after a callback’s server-side processing has been completed.

Declaration

EndCallback: ASPxClientEvent<ASPxClientEndCallbackEventHandler<ASPxClientReportViewer>>

Event Data

The EndCallback event's data class is ASPxClientEndCallbackEventArgs. The following properties provide information specific to this event:

Property Description
command Gets a command name that identifies which client action forced a callback to occur.

Remarks

The ASPxClientReportViewer.BeginCallback and EndCallback events can be used to perform specific client-side actions when a callback is being processed on a server.

See Also

PageLoad Event

Occurs on the client side when another report page is loaded into this ASPxClientReportViewer instance.

Declaration

PageLoad: ASPxClientEvent<ASPxClientReportViewerPageLoadEventHandler<ASPxClientReportViewer>>

Event Data

The PageLoad event's data class is ASPxClientReportViewerPageLoadEventArgs. The following properties provide information specific to this event:

Property Description
PageCount Gets a value specifying the total number of pages displayed in a report viewer.
PageIndex Gets a value specifying a zero-based index of a page to be displayed in a report viewer.

The event data class exposes the following methods:

Method Description
IsFirstPage Gets a value indicating whether a report page, which is currently loaded into the ASPxClientReportViewer, is the first page of a report.
IsLastPage Gets a value indicating whether a report page, which is currently loaded into the ASPxClientReportViewer, is the last page of a report.

Remarks

Handle the PageLoad event to perform an action every time a Report Viewer navigates to another report page. For example, if you’re implementing a custom Report Toolbar, you may use the ASPxClientReportViewerPageLoadEventArgs.IsFirstPage and ASPxClientReportViewerPageLoadEventArgs.IsLastPage properties to determine the state of ReportToolbarItemKind.FirstPage, ReportToolbarItemKind.PreviousPage, ReportToolbarItemKind.NextPage and ReportToolbarItemKind.LastPage toolbar buttons. Also, you may obtain the ASPxClientReportViewerPageLoadEventArgs.PageCount and ASPxClientReportViewerPageLoadEventArgs.PageIndex values to show this information in a custom Report Toolbar.