Back to Devexpress

ASPxClientDocumentViewer Class

xtrareports-js-aspxclientdocumentviewer.md

latest15.5 KB
Original Source

ASPxClientDocumentViewer Class

The client-side equivalent of the ASPxWebDocumentViewer control.

Declaration

ts
declare class ASPxClientDocumentViewer extends ASPxClientControl

Remarks

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

aspx
<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>

Inherited Members

Init

name

AdjustControl

GetClientVisible

GetHeight

GetMainElement

GetParentControl

GetVisible

GetWidth

InCallback

SendMessageToAssistiveTechnology(message)

SetClientVisible(visible)

SetHeight(height)

SetVisible(visible)

SetWidth(width)

AdjustControls

GetControlCollection

Inheritance

ASPxClientControlBase ASPxClientControl ASPxClientDocumentViewer

See Also

ASPxClientWebDocumentViewer

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

ts
static Cast(
    obj: any
): ASPxClientDocumentViewer

Parameters

NameTypeDescription
objany

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

|

Returns

TypeDescription
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:

  • 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:

GetDocumentMap Method

Provides access to the document of the ASPxClientDocumentViewer.

Declaration

ts
GetDocumentMap(): ASPxClientReportDocumentMap

Returns

TypeDescription
ASPxClientReportDocumentMap

An ASPxClientReportDocumentMap object.

|

GetParametersPanel Method

Provides access to the parameters panel of the ASPxClientDocumentViewer.

Declaration

ts
GetParametersPanel(): ASPxClientReportParametersPanel

Returns

TypeDescription
ASPxClientReportParametersPanel

An ASPxClientReportParametersPanel object.

|

GetRibbonToolbar Method

Provides access to the Ribbon of the ASPxClientDocumentViewer.

Declaration

ts
GetRibbonToolbar(): ASPxClientRibbon

Returns

TypeDescription
ASPxClientRibbon

A Ribbon object.

|

GetSplitter Method

Provides access to the Splitter of the ASPxClientDocumentViewer.

Declaration

ts
GetSplitter(): ASPxClientSplitter

Returns

TypeDescription
ASPxClientSplitter

A Splitter object.

|

GetToolbar Method

Provides access to the Document Viewer toolbar on the client.

Declaration

ts
GetToolbar(): ASPxClientReportToolbar

Returns

TypeDescription
ASPxClientReportToolbar

An ASPxClientReportToolbar object.

|

GetViewer Method

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

Declaration

ts
GetViewer(): ASPxClientReportViewer

Returns

TypeDescription
ASPxClientReportViewer

An ASPxClientReportViewer object.

|

GotoBookmark(pageIndex, bookmarkPath) Method

Sets focus on the report control specified by its bookmark.

Declaration

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

Parameters

NameTypeDescription
pageIndexnumber

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

ts
GotoPage(
    pageIndex: number
): void

Parameters

NameTypeDescription
pageIndexnumber

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

ts
IsSearchAllowed(): boolean

Returns

TypeDescription
boolean

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

|

Prints the document’s page with the specified page index.

Declaration

ts
Print(
    pageIndex?: number
): void

Parameters

NameTypeDescription
pageIndexnumber

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

ts
Refresh(): void

SaveToDisk(format) Method

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

Declaration

ts
SaveToDisk(
    format: string
): void

Parameters

NameTypeDescription
formatstring

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

ts
SaveToWindow(
    format: string
): void

Parameters

NameTypeDescription
formatstring

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”

Search Method

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

Declaration

ts
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

ts
BeginCallback: ASPxClientEvent<ASPxClientBeginCallbackEventHandler<ASPxClientDocumentViewer>>

Event Data

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

PropertyDescription
commandGets a command name that identifies which client action initiated a callback.

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

ts
CallbackError: ASPxClientEvent<ASPxClientCallbackErrorEventHandler<ASPxClientDocumentViewer>>

Event Data

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

PropertyDescription
handledGets or sets whether the event is handled and the default error handling actions are not required.
messageGets 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

BeginCallback

EndCallback

EndCallback Event

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

Declaration

ts
EndCallback: ASPxClientEvent<ASPxClientEndCallbackEventHandler<ASPxClientDocumentViewer>>

Event Data

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

PropertyDescription
commandGets 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

ts
PageLoad: ASPxClientEvent<ASPxClientReportViewerPageLoadEventHandler<ASPxClientDocumentViewer>>

Event Data

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

PropertyDescription
PageCountGets a value specifying the total number of pages displayed in a report viewer.
PageIndexGets 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:

MethodDescription
IsFirstPageGets a value indicating whether a report page, which is currently loaded into the ASPxClientReportViewer, is the first page of a report.
IsLastPageGets a value indicating whether a report page, which is currently loaded into the ASPxClientReportViewer, is the last page of a report.

ToolbarItemClick Event

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

Declaration

ts
ToolbarItemClick: ASPxClientEvent<ASPxClientEventHandler<ASPxClientDocumentViewer>>

Event Data

The ToolbarItemClick event's data class is ASPxClientEventArgs.

ToolbarItemValueChanged Event

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

Declaration

ts
ToolbarItemValueChanged: ASPxClientEvent<ASPxClientEventHandler<ASPxClientDocumentViewer>>

Event Data

The ToolbarItemValueChanged event's data class is ASPxClientEventArgs.