This is a migrated thread and some comments may be shown as answers.
save dynamic dock's position and index only
3 Answers 42 Views
This is a migrated thread and some comments may be shown as answers.
Priya
Top achievements
Rank 1
Priya asked on 22 Dec 2008, 05:00 AM
Sir,

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 

StoreLayoutInViewState

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

 

Dim stateList As List(Of DockState) = DkLayoutDocMain.GetRegisteredDocksState()  
Me.ClearChildControlState()  
Me.ClearChildViewState()  
Me.ClearChildState()  
DkLayoutDocMain.Dispose()  
ViewState.Clear()  
 

plz help me...

 

3 Answers, 1 is accepted

Sort by
0
Nikolay Raykov
Telerik team
answered on 23 Dec 2008, 12:38 PM
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.
0
HL
Top achievements
Rank 1
answered on 14 Nov 2011, 07:30 PM
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

SaveDockLayout

 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

 

Dim

 

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?

Thanks
Helena


 

 

 

0
Slav
Telerik team
answered on 16 Nov 2011, 05:33 PM
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,
Slav
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
Tags
Dock
Asked by
Priya
Top achievements
Rank 1
Answers by
Nikolay Raykov
Telerik team
HL
Top achievements
Rank 1
Slav
Telerik team
Share this question
or