Skip to main content

ASPxClientDockZone.BeforeDock Event

Fires on the client side before a panel is docked in a zone and allows you to cancel the action.

Declaration

BeforeDock: ASPxClientEvent<ASPxClientDockZoneCancelEventHandler<ASPxClientDockZone>>

Event Data

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

Property Description
cancel Gets or sets a value indicating whether the action which raised the event should be canceled. Inherited from ASPxClientProcessingModeCancelEventArgs.
panel Gets the panel currently being processed.
processOnServer Specifies whether or not to process the event on the server. Inherited from ASPxClientProcessingModeEventArgs.

Remarks

Write a BeforeDock event handler to perform specific actions on the client side before every time the panel is docked. You can use the event parameter’s properties to identify a panel (ASPxClientDockZoneCancelEventArgs.panel) currently being processed.

Note that if the cancel property is set to true in the event’s handler, the execution of the current command is canceled on the client side, and therefore no further processing is performed (that is the panel is not docked). If the command execution is not canceled (the cancel property is set to the default false value), further event processing depends upon the processOnServer property setting.

If the processOnServer property is set to false, the BeforeDock event is completely handled on the client side, using the assigned JScript handler without a postback to the server.

Setting the processOnServer property to true indicates that the final processing of the event should be performed on the server side, and so a round trip to the server is required. During such a round trip the corresponding server-side ASPxDockZone.BeforeDock event is fired, which when handled, allows any desired server-side action to be performed.

Note

The BeforeDock event only fires when you dock a panel by dragging it. If you dock a panel programmatically (e.g. by setting the ASPxDockPanel.OwnerZoneUID property) it does not result in firing the event.

To learn more, see the Common Docking Events topic.

Example

The code sample below demonstrates how you can limit the number of panels contained within a zone.

<dx:ASPxDockZone ID="MyASPxDockZone" runat="server" ZoneUID="MyZone">
     <ClientSideEvents BeforeDock="function(s, e) {
          if (s.GetPanelCount() > 2) 
          e.cancel = true;
     }" />
</dx:ASPxDockZone>
See Also