How to loop through the existing RadDock's in a RadDockLayout and dispose of them client side

4 posts, 0 answers
  1. hkdave95
    hkdave95 avatar
    245 posts
    Member since:
    Nov 2006

    Posted 11 Jul 2008 Link to this post

    Hi

    I have a requirement whereby I need to loop through all Docks in a DockLayout and dispose of them client side.

    Can you help me with some code that does this ?

    Kind Regards

    David
  2. Sophy
    Admin
    Sophy avatar
    636 posts

    Posted 11 Jul 2008 Link to this post

    Hi,

    RadDockLayout does not provide client-side functionality. You can go through all RadDockZones on the page and using the client-side method get_docks which they provide to take the docks in each of them.
    The other option is to handle the OnClientInitialize event of the RadDock and register each of the docks in a collection which you can use afterwards, e.g:
    <script type="text/javascript">  
    var docks = [];  
    function registerDock(dock)  
    {  
        if (!Array.contains(docks, dock))  
            Array.add(docks, dock);  
    }  
    </script> 
    <telerik:raddock id="dock1" runat="server" onclientinitialize="registerDock"></telerik:raddock> 
    However, the docks are rendered server-side and it is not possible to dispose them on the client.

    Kind regards,
    Sophy
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rubicon Computer Systems
    Rubicon Computer Systems avatar
    12 posts
    Member since:
    Apr 2007

    Posted 11 Jul 2008 Link to this post

    Hi

    Thanks for your swift reply.

    This will almost work.

    However, server side I have a problem whereby when I try and recreate my Docks after moving them around the screen, I get an error saying I cannot add the dock again.

    I am clearing my RadDocLayout Controls before re-adding, however it still says that the Dock already exists on the page.

    This error only seems to occur after I have moved the RadDock on the page.

    I do not use RadDockZones so all my RadDocks are floating.

    Kind Regards

    David
  5. Sophy
    Admin
    Sophy avatar
    636 posts

    Posted 11 Jul 2008 Link to this post

    Hi Rubicon,

    The problem you experience is most probably due to recreating docks having the same ids as those of already existing docks on the page. Do you use Ajax to partially update the page? Could you please open a support ticket and attach a simple running page which reproduces issue you describe so that we can take a closer look at your code and investigate the problem?
    We will be glad to help you solve the issue.

    Kind regards,
    Sophy
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top