I am loading RadDocks from SQL and state as well, I'm having trouble with RadDock.ApplyState(state).. There has to be a loop from the database to load the controls but at the same time there has to be a loop to apply the state, does anyone have an example of this?
Here is the code I am talking about, this loop is based on the propery list of DockState
However I load the usercontrols into RadDocks with a While Loop from a datareader like this:
So my problem is in order to call ApplyState(State) in Page_Init and get the correct closed , collapsed state from the DB I need to have 2 loops........ Not sure how to accomplish this. The underlying issue is the Closed and Collapsed state is being overwritten before the controls render and Im losing those 2 pieces of state.
Thanks!
Sam
Here is the code I am talking about, this loop is based on the propery list of DockState
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) |
Dim i As Integer = 0 |
While i < CurrentDockStates.Count |
Dim dock As RadDock = CreateRadDockFromState(CurrentDockStates(i)) |
RadDockLayout1.Controls.Add(dock) |
CreateSaveStateTrigger(dock) |
System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1) |
End While |
End Sub |
However I load the usercontrols into RadDocks with a While Loop from a datareader like this:
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init |
Dim RoleID As Integer |
Dim drContacts As SqlDataReader |
Dim control As New Web.UI.Control() |
Dim count As Integer = 0 |
RadDockZone1.Controls.Clear() |
RadDockZone0.Controls.Clear() |
Dim state As New DockState() |
Dim Edit As String = Utilities.GetSession("Edit Layout Allowed") |
RoleID = Int32.Parse(Utilities.GetSession("PortalRoleID")) |
drContacts = PortalDataAccess.GetPortalControlsByRoleID(RoleID) |
If (drContacts.HasRows) Then |
While (drContacts.Read()) |
Dim soRadDock As New RadDock() |
soRadDock.ID = drContacts("ControlID").ToString() |
soRadDock.Title = drContacts("ControlTitle").ToString() |
control = LoadControl("UserControls/" & drContacts("ControlName").ToString() & ".ascx") |
soRadDock.ContentContainer.Controls.Add(control) |
If drContacts("Zone") = 1 Then |
CreateSaveStateTriggers(soRadDock) |
soRadDock.ApplyState(state) |
RadDockZone1.Controls.Add(soRadDock) |
End If |
If drContacts("Zone") = 0 Then |
CreateSaveStateTriggers(soRadDock) |
soRadDock.ApplyState(state) |
RadDockZone0.Controls.Add(soRadDock) |
End If |
End While |
drContacts.Close() |
End If |
End Sub |
So my problem is in order to call ApplyState(State) in Page_Init and get the correct closed , collapsed state from the DB I need to have 2 loops........ Not sure how to accomplish this. The underlying issue is the Closed and Collapsed state is being overwritten before the controls render and Im losing those 2 pieces of state.
Thanks!
Sam