This is a migrated thread and some comments may be shown as answers.

How to limit the number of RadDock in the RadDockZone

1 Answer 12 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Meng
Top achievements
Rank 1
Meng asked on 09 Sep 2014, 08:36 PM
Hi there,

I have a few empty RadDockZones in my page, and want to limit only one RadDock to be allowed to put in each of the zone. If there is already a RadDock in the zone, then the move of the RadDock will be cancelled. Is there any way to achieve this? Any advice is much appreciated.

Regards,
Meng

1 Answer, 1 is accepted

Sort by
0
Meng
Top achievements
Rank 1
answered on 11 Sep 2014, 03:20 PM
Got it working now, just want to share the code here:

<telerik:RadScriptBlock runat="server">
        <script type="text/javascript">
            var originalZoneID = "";
            var originalZone = new object();
            function OnClientDragStart(dock, args) {
                originalZoneID = dock.get_dockZoneID();
                originalZone = dock.get_dockZone();
            }
            function OnClientDockPositionChanged(dock, args) {
                var currentZone = dock.get_dockZone();
                if (currentZone.get_id() != originalZoneID) {
                    if (currentZone.get_docks().length >= 2) {
                        originalZone.dock(dock);
                        alert("Each zone can have only 1 dock!");
                    }
                }
            }
        </script>
    </telerik:RadScriptBlock>
‚Äč
Tags
Dock
Asked by
Meng
Top achievements
Rank 1
Answers by
Meng
Top achievements
Rank 1
Share this question
or