I am creating RadDocks dynamically. Each RadDock is created with a custom control (ascx). I have a RadDock command which displays a dialog in a RadWindow which allows me to change values in the custom control in the RadDock and also the size and title of the RadDock. All this works except changing the size of the RadDock. (I'm even able to change the title of the RadDock without a problem.)
After the first creation of the RadDock, on postback the RadDocks are re-created in Page_Init using the Rad Dock states - and then I apply my new dock width after I apply the state. What am I missing?
Any help is appreciated. Thanks.
After the first creation of the RadDock, on postback the RadDocks are re-created in Page_Init using the Rad Dock states - and then I apply my new dock width after I apply the state. What am I missing?
Protected Sub Page_Load(sender As Object, e As System.EventArgs) If Not IsPostBack Then 'CreateRadDock() routine is eventually called from here along with some other stuff that I don't think is relevant End IfEnd SubProtected Sub Page_Init(sender As Object, e As System.EventArgs) 'Recreate the docks in order to ensure their proper operation If IsPostBack Then UpdateZone() End IfEnd SubPrivate Function CreateRadDock(Title As String, SectionCount As Integer) As RadDock Dim dock As New RadDock() dock.DockMode = DockMode.Docked dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a") dock.ID = String.Format("RadDock{0}", dock.UniqueName) dock.Title = Title 'dock.Text = String.Format("Added at {0}", DateTime.Now) dock.Width = Unit.Pixel(270 * SectionCount) dock.Resizable = True dock.Height = Unit.Pixel(400) dock.Skin = "Office2010Black" 'RadAjaxManagerProxy1.AjaxSettings.AddAjaxSetting(dock, RadDockZone1, RadAjaxLoadingPanel1) AddHandler dock.Command, AddressOf dock_Command dock.Commands.Add(New DockCloseCommand()) dock.Commands.Add(New DockExpandCollapseCommand()) SetPropertiesCommand(dock) Return dockEnd FunctionSub UpdateZone() RadDockZone1.Controls.Clear() Dim i As Integer = 0 While i < CurrentDockStates.Count Dim dock As RadDock = CreateRadDockFromState(CurrentDockStates(i), i) RadDockLayout1.Controls.Add(dock) 'We want to save the dock state every time a dock is moved. CreateSaveStateTrigger(dock) System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1) End WhileEnd Sub Private Function CreateRadDockFromState(state As DockState, PanelOrder As Integer) As RadDock Dim PanelID As String = String.Format("RadDock{0}", state.UniqueName) Dim panel As clsDashboardPanelMapItem = New clsDashboardPanelMapItem() panel = Session(PanelID) Dim properties As Hashtable = Session("properties_" & panel.PanelID & "_" & panel.SectionCount) Dim dock As New RadDock() dock.DockMode = DockMode.Docked dock.ID = PanelID dock.Skin = "Office2010Black" dock.ApplyState(state) dock.Width = Unit.Pixel(270 * properties("PanelCount")) dock.Height = Unit.Pixel(400) dock.Title = properties("PanelTitle") 'Load the custom control Dim UserControl As Control = SetSection(panel.PanelModulePath, properties("PanelTitle"), panel.PanelDesc, properties, Nothing, properties("PanelCount"), panel.PanelID, panel.SectionCount, panel.ObjectName) dock.ContentContainer.Controls.Add(UserControl) AddHandler dock.Command, AddressOf dock_Command dock.Commands.Add(New DockCloseCommand()) dock.Commands.Add(New DockExpandCollapseCommand()) SetPropertiesCommand(dock) Return dockEnd FunctionPrivate Sub CreateSaveStateTrigger(dock As RadDock) 'Ensure that the RadDock control will initiate postback ' when its position changes on the client or any of the commands is clicked. 'Using the trigger we will "ajaxify" that postback. dock.AutoPostBack = True dock.CommandsAutoPostBack = TrueEnd SubSub SetPropertiesCommand(dock As RadDock) Dim propCmd As DockCommand = New DockCommand() propCmd.Name = "Properties" propCmd.Text = "Properties" propCmd.CssClass = "DockPropertiesCommand" propCmd.AutoPostBack = True dock.Commands.Insert(0, propCmd)End Sub<telerik:RadDockLayout ID="RadDockLayout1" runat="server" Skin="Default" OnSaveDockLayout="RadDockLayout1_SaveDockLayout" OnLoadDockLayout="RadDockLayout1_LoadDockLayout" StoreLayoutInViewState="True"> <telerik:RadDockZone ID="RadDockZone1" runat="server" Height="1400px" Width="1100px" Skin="Black" Orientation="Horizontal"> </telerik:RadDockZone></telerik:RadDockLayout>Any help is appreciated. Thanks.