I tried to add code to define the position to the several docks that I have on the same page, but I'm having some problems.
I used the example on this link: http://www.telerik.com/help/aspnet-ajax/dock_dockcontrolcreation.html because it's similar to what I want to create, but it doesn't work.
My intention is, on the same page, have several docks that are in .ascx files.
On the default page I have a radDockLayout and inside this control I have the .ascx files:
<
telerik:RadDockLayout ID="RadDockLayout1" runat="server" OnSaveDockLayout="RadDockLayout1_SaveDockLayout" OnLoadDockLayout="RadDockLayout1_LoadDockLayout">
<uc5:barraLateral ID="BarraLateral1" runat="server" />
<uc2:TodosConteudos ID="TodosConteudos1" runat="server" />
<uc3:MeusConteudos ID="MeusConteudos1" runat="server" />
<uc4:UltimosConteudos ID="UltimosConteudos1" runat="server" />
</telerik:RadDockLayout>
And in the default code page I have the following code:
using
System;
using
System.Collections;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Web;
using
System.Web.SessionState;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.HtmlControls;
using
Telerik.Web.UI;
public
partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//Store the info about the added docks in the session.
private List<DockState> CurrentDockStates
{
get
{
List<DockState> _currentDockStates = (List<DockState>)Session["CurrentDockStates"];
if (Object.Equals(_currentDockStates, null))
{
_currentDockStates =
new List<DockState>();
Session[
"CurrentDockStates"] = _currentDockStates;
}
return _currentDockStates;
}
set
{
Session[
"CurrentDockStates"] = value;
}
}
protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)
{
CurrentDockStates = RadDockLayout1.GetRegisteredDocksState();
}
protected void Page_Init(object sender, EventArgs e)
{
for (int i = 0; i < CurrentDockStates.Count; i++)
{
RadDock dock = new RadDock();
dock.ID =
string.Format("RadDock{0}", i);
dock.ApplyState(CurrentDockStates[i]);
RadDockLayout1.Controls.Add(dock);
}
}
protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e)
{
foreach (DockState state in CurrentDockStates)
{
e.Positions[state.UniqueName] = state.DockZoneID;
e.Indices[state.UniqueName] = state.Index;
}
}
}
I don't want to create new docks, I just want to save the position of the docks that are on those .ascx files, but I can't save because they are not on the default page. How can I solve this problem without copy all the code from the .ascx files to the defaul page?