The requested page is not available for the requested platform. You are viewing the content for Default platform.
All docs
V19.1
19.2 (EAP/Beta)
19.1
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

ASPxClientDocumentViewer Class

The client-side equivalent of the ASPxDocumentViewer control.

Declaration

declare class ASPxClientDocumentViewer extends ASPxClientControl

Remarks

The ASPxDocumentViewer control provides an older version of a Document Viewer. To take advantage of HTML5/JS technology, consider using the HTML5 Document Viewer instead.

The following code illustrates how to access a document viewer on the client.

<dx:ASPxDocumentViewer ID="DocumentViewer1" runat="server"
    ReportName="WebApplication2.XtraReport1"
    ClientInstanceName="documentViewer1">
        <ClientSideEvents PageLoad="function(s, e) {
        var nextpage = e.PageIndex + 1 < e.PageCount ? e.PageIndex + 1 : 0;
        setTimeout('switchPage(' + nextpage + ')', 5000);
        }" />
</dx:ASPxDocumentViewer>

<script language="javascript" type="text/javascript">
    function switchPage(nextPage) {
        documentViewer1.GotoPage(nextPage);
    }
</script>
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): ASPxClientDocumentViewer

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
ASPxClientDocumentViewer

An ASPxClientDocumentViewer object.

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 ASPxClientDocumentViewer type. As a result, the object's type is now known and ASPxClientDocumentViewer 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 = ASPxClientDocumentViewer.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 'ASPxClientDocumentViewer1', the object can be type cast in the following manner:

    ...
    var clientObject = ASPxClientDocumentViewer.Cast('ASPxClientDocumentViewer1');
    

GetDocumentMap Method

Provides access to the document of the ASPxClientDocumentViewer.

Declaration

GetDocumentMap(): ASPxClientReportDocumentMap

Returns

Type Description
ASPxClientReportDocumentMap

An ASPxClientReportDocumentMap object.

GetParametersPanel Method

Provides access to the parameters panel of the ASPxClientDocumentViewer.

Declaration

GetParametersPanel(): ASPxClientReportParametersPanel

Returns

Type Description
ASPxClientReportParametersPanel

An ASPxClientReportParametersPanel object.

GetRibbonToolbar Method

Provides access to the Ribbon of the ASPxClientDocumentViewer.

Declaration

GetRibbonToolbar(): ASPxClientRibbon

Returns

Type Description
ASPxClientRibbon

A Ribbon object.

GetSplitter Method

Provides access to the Splitter of the ASPxClientDocumentViewer.

Declaration

GetSplitter(): ASPxClientSplitter

Returns

Type Description
ASPxClientSplitter

A Splitter object.

GetToolbar Method

Provides access to the Document Viewer toolbar on the client.

Declaration

GetToolbar(): ASPxClientReportToolbar

Returns

Type Description
ASPxClientReportToolbar

An ASPxClientReportToolbar object.

GetViewer Method

Obsolete. Provides access to the ASPxClientDocumentViewer's preview that exposes methods to print and export the document.

Declaration

GetViewer(): ASPxClientReportViewer

Returns

Type Description
ASPxClientReportViewer

An ASPxClientReportViewer object.

GotoBookmark(pageIndex, bookmarkPath) Method

Sets focus on the report control specified by its bookmark.

Declaration

GotoBookmark(pageIndex: number, bookmarkPath: string): void

Parameters

Name Type Description
pageIndex number

An integer value, specifying the page index.

bookmarkPath string

A String value, specifying the path to the bookmark.

GotoPage(pageIndex) Method

Displays the specified report page.

Declaration

GotoPage(pageIndex: number): void

Parameters

Name Type Description
pageIndex number

An integer value, identifying the report page.

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 the document's page with the specified page index.

Print(pageIndex?: number): void
Name Type Default Description
pageIndex number null

A Int32 representing the index of the page to be printed.

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 ASPxClientDocumentViewer.IsSearchAllowed method returns true.

Events

BeginCallback Event

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

Declaration

BeginCallback: ASPxClientEvent<ASPxClientBeginCallbackEventHandler>

Event Data

The BeginCallback event handler receives an argument of the ASPxClientBeginCallbackEventArgs type. 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 BeginCallback and ASPxClientDocumentViewer.EndCallback events can be used to perform specific client-side actions while a callback is being processed on the server side.

CallbackError Event

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

Declaration

CallbackError: ASPxClientEvent<ASPxClientCallbackErrorEventHandler>

Event Data

The CallbackError event handler receives an argument of the ASPxClientCallbackErrorEventArgs type. 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. You can handle this event to perform specific client-side actions, such as displaying explanatory text or an image related to the error, for example.

Typically, a server error which occurs during server-side processing of a callback leads to the 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.

See Handling Callback Exceptions on Client to learn more.

See Also

EndCallback Event

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

Declaration

EndCallback: ASPxClientEvent<ASPxClientEndCallbackEventHandler>

Event Data

The EndCallback event handler receives an argument of the ASPxClientEndCallbackEventArgs type. 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 ASPxClientDocumentViewer.BeginCallback and EndCallback events can be used to perform specific client-side actions when a callback is being processed on a server.

PageLoad Event

Occurs on the client side when a report page is loaded into this ASPxClientDocumentViewer instance.

Declaration

PageLoad: ASPxClientEvent<ASPxClientReportViewerPageLoadEventHandler<ASPxClientDocumentViewer>>

Event Data

The PageLoad event handler receives an argument of the ASPxClientReportViewerPageLoadEventArgs type. 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.

ToolbarItemClick Event

Occurs when an item within the Document Viewer's report toolbar is clicked.

Declaration

ToolbarItemClick: ASPxClientEvent<ASPxClientEventHandler>

Event Data

The ToolbarItemClick event handler receives an argument of the ASPxClientEventArgs type.

ToolbarItemValueChanged Event

Occurs when the value of an item within the Document Viewer's report toolbar is changed.

Declaration

ToolbarItemValueChanged: ASPxClientEvent<ASPxClientEventHandler>

Event Data

The ToolbarItemValueChanged event handler receives an argument of the ASPxClientEventArgs type.