How to limit the number of RadDock in the RadDockZone

2 posts, 0 answers
  1. Meng
    Meng avatar
    57 posts
    Member since:
    Apr 2011

    Posted 09 Sep 2014 Link to this post

    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
  2. Meng
    Meng avatar
    57 posts
    Member since:
    Apr 2011

    Posted 11 Sep 2014 in reply to Meng Link to this post

    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>
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top