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

Close all dynamically created dock on a button click

2 Answers 69 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 23 Jun 2008, 04:38 PM
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 Answers, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 26 Jun 2008, 01:04 PM
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
0
Chris
Top achievements
Rank 1
answered on 26 Jun 2008, 01:48 PM
Petio,

Thanks!

Chris
Tags
Dock
Asked by
Chris
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Chris
Top achievements
Rank 1
Share this question
or