save dynamic dock's position and index only

4 posts, 0 answers
  1. Priya
    Priya avatar
    144 posts
    Member since:
    Jul 2008

    Posted 21 Dec 2008 Link to this post


    In your demo 'dynamically adding dock'.its saving the entire dock's state.but my requirement is to store only the dock's position and index..and have to keep it in each page_load..

    Another prbm is the raddocklayout's registereddocksstate is not clearing..
    I used 


    ="false" EnableViewState="false"
    and tried with


    Dim stateList As List(Of DockState) = DkLayoutDocMain.GetRegisteredDocksState()  

    plz help me...


  2. Nikolay Raykov
    Nikolay Raykov avatar
    102 posts

    Posted 23 Dec 2008 Link to this post

    Hi Priya,

    You can persist the position and the Dock Zone ID but you will need the Unique Name of the dock as well. You need it because it is used as a key in the properties Positions and Indices(which are Dictionary objects part of the DockLayoutEventArgs class) which specify where the dock should go - which zone and the position inside it:

     Protected Sub RadDockLayout1_LoadDockLayout( _  
                    sender As Object, _  
                    e As DockLayoutEventArgs) _  
                    Handles RadDockLayout1.LoadDockLayout  
      For Each state As DockState In CurrentDockStates  
        e.Positions(state.UniqueName) = state.DockZoneID  
        e.Indices(state.UniqueName) = state.Index  
      Next state  
    End Sub  

    As you can see you could rely solely on these three values - index, Dock Zone Id and Unique Name but you will not be able to recreate the content of the docks. It is up to the developer to decide how to persist the content during postbacks. For example you could use the Tag property of the dock. Based on that information you could create your own class with four fields (index, Dock Zone ID, Unique Name and tag) and use it to persist the state of your docks.

    GetRegisteredDocksState method does not use ViewState to return the DockState of its docks. When you call this method it iterates over the collection of docks and creates DockState objects based on them.

    When you set StoreLayoutInViewState to false you are actually telling RadDockLayout that you will take care of persisting the state of the docks. Then you need to save the state in the event handler of the SaveDockLayout event.

    All the best,
    Nikolay Raykov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. HL
    HL avatar
    55 posts
    Member since:
    Dec 2009

    Posted 14 Nov 2011 Link to this post

    Hi Nikolay:
        I have some issue on my project so I kept searching any topic related with Dock index.I am littble bit comfused with these three
    event :
    1. LoadDockLayout
    2. CreateRadDockFromState
    3. RadDockLayout1.GetRegisteredDocksState

    As lots of exmaple mentioned that we should CreateDockfromstate on page_init then LoadDockLayout will fire then


     will fire.  my confused is that :
    1. if I load dock from state after page load
    2. I drag and drop dock from zone1 to zone 2
    3. then on page_init , I supposed to create dock from state, what state is now? the state after dock dropped ?

    My issue is that the index won't save properly after I drag and drop dock. I found I am in loop
    1. when I drag and drop dock, I will call CreateRadDockFromState but now the state is still the old state and the index number is not changed
    2. then the event LoadDockLayout fire. inside this event, I called




    stateList As List(Of DockState) = Me.RadDockLayout1.GetRegisteredDocksState()


    but the dock index is old one and didn't change based on its new location

    3. then when RadDockLayout1_SaveDockLayout fired, the dock state is still same with previous so the dock position didn't update at all after reload page








    any suggestion?





  4. Slav
    Slav avatar
    1359 posts

    Posted 16 Nov 2011 Link to this post

    Hello Helena,

    Please refer to your original forum thread, in which I have provided assistance on the problem at hand.

    Note that our conversation on the issue at hand will be much easier to track if you use only one thread or support ticket for reporting a particular problem, so I would suggest doing so for future use of our support system. That being said, let's continue our discussion in the forum thread, specified above.

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top