Removing a Dock programmatically

3 posts, 1 answers
  1. Rob Linxweiler
    Rob Linxweiler avatar
    5 posts
    Member since:
    Oct 2009

    Posted 09 Nov 2009 Link to this post


    I've built a "portal" interface, combining dynamic TabStrip and RadDockLayout/Zone/Dock controls, fed from a database.

    When the user clicks on a different tab, I want to show a different set of docks.  On the postback, though, the docks from the soon-to-be-previous tab are still in viewstate and get reattached to their Zones.  I added a method to clear them:

        ''' <summary> 
        ''' Clear all docks from a given raddocklayout 
        ''' </summary> 
        ''' <param name="rdLayout">given raddocklayout</param> 
        ''' <remarks></remarks> 
        Public Sub ClearAllDocks(ByVal rdLayout As RadDockLayout) 
            Dim rdZones As ReadOnlyCollection(Of RadDockZone) = rdLayout.RegisteredZones() 
            For Each rdZone As RadDockZone In rdZones 
                'For Each rdDock As RadDock In rdZone.Docks() 
                '    rdDock.Closed = True 
        End Sub 

    The .Clear() method isn't working.  It just plain doesn't clear the Zone.  The Docks are still there, before and after the .Clear() call.

    I changed to the (commented out) .Closed = True option, but that seems slow and klunky to me. 

    a) is there a reason that .Clear() wouldn't work?  I do realize I'm using a readonly collection to access them, but RegisteredZones only returns readonly. 

    b) is there a better way of clearing all the Docks in a Layout? 

  2. Pero
    Pero avatar
    1156 posts

    Posted 12 Nov 2009 Link to this post

    Hi Rob,

    Regarding your questions:

    1. The Clear() method is not working, because the Collection of RadDocks is, as you said, read-only and cannot be modified.

    2. There is no other way to clear the docks in the layout. To improve the performance, my recommendation is, when you change the tab, to [re]create the set of docks that are associated with the current tab. This way only the docks that can be seen from a certain tab, will be present on the page and the others will not be there.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
  4. Answer
    skysailor avatar
    113 posts
    Member since:
    Jul 2007

    Posted 18 Nov 2009 Link to this post


    Try :-

    That worked for me!

Back to Top