New to Telerik UI for ASP.NET AJAX? Download free 30-day trial


The OnClientBeforeClose event of the RadWindow control fires when it is about to close. This event can be cancelled (see Example 1) to prevent the closing operation (and the OnClientClose event from firing). The close operation can be initiated from the user by clicking or tapping on the manual close button (X) in the top right-hand side corner of the title bar, or by the developer via calling the close(optionalArguments) client-side method of the control.

You can also use this event to ask the user to confirm whether the dialog should close(e.g., if there is no data supplied as an argument).

The event handler receives the following arguments:

  1. The RadWindow object that fired the event.

  2. An event arguments object that exposes the following methods:

Name Parameters Return Type Description
get_argument object This is the argument passed to the close()method of the RadWindow by the developer.
get_cancel boolean Gets a value indicating whether the event is going to be cancelled.
set_cancel boolean Sets a value indicating whether the event is going to be cancelled.Pass true to cancel the event.The method takes the following arguments: boolean—a value that indicates whether the event is to be cancelled.

Example 1: Cancelling the OnClientBeforeClose event of the RadWindow to prevent its closing operation.

<telerik:RadWindow RenderMode="Lightweight" runat="server" ID="RadWindow1" OnClientBeforeClose="OnClientBeforeClose" VisibleOnPageLoad="true"></telerik:RadWindow>
<script type="text/javascript">
    function OnClientBeforeClose(sender, args) {
        args.set_cancel(true);//you cannot close this RadWindow

See Also

In this article