Close all dynamically created dock on a button click

3 posts, 0 answers
  1. Chris
    Chris avatar
    171 posts
    Member since:
    Oct 2006

    Posted 23 Jun 2008 Link to this post

    Hi,

    From the sample
    http://www.telerik.com/DEMOS/ASPNET/Prometheus/Dock/Examples/DynamicDocks/DefaultCS.aspx

    I just wonder if there is a way to have a button which allows me to click on it and close all dynamically created docks with asp ajax?

    Chris
  2. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 26 Jun 2008 Link to this post

    Hello Chris,

    I created a simple javascript function (The same as the response script from the MyPortal example, which is used to remove the RadDock when it is closed by the "x" button), which iterates through all RadDocks and set them to be closed. Once the RadDocks are closed, it makes an ajax call to the server - I believe that this is what you need to achieve.
    Here it is:
    <script type="text/javascript">  
         function RemovaAllDocks()  
         {  
          var zone1 = $find("<%=RadDockZone1.ClientID %>");  
          var zone2 = $find("<%=RadDockZone2.ClientID %>");  
          var lastObject;  
          for(var i=zone1.get_docks().length-1;i>=0;i--)  
          {  
                lastObject = zone1.get_docks()[i];  
                lastObject.set_closed(true);  
                lastObject.undock();  
                $get('<%=UpdatePanel1.ClientID %>').appendChild($get(lastObject.get_id()));  
           }  
           for(var i=zone2.get_docks().length-1;i>=0;i--)  
          {  
                lastObject = zone2.get_docks()[i];  
                lastObject.set_closed(true);  
                lastObject.undock();  
                $get('<%=UpdatePanel1.ClientID %>').appendChild($get(lastObject.get_id()));  
           }  
          lastObject.doPostBack('DockPositionChanged');  
         }  
        </script> 

    Let us know if you need any further assistance.


    Best wishes,
    Petio Petkov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Chris
    Chris avatar
    171 posts
    Member since:
    Oct 2006

    Posted 26 Jun 2008 Link to this post

    Petio,

    Thanks!

    Chris
Back to Top