Hello everyone,
I'd appreciate if anyone can help me in the following.
I have a page with
1 RadDockLayout
2 Rad DocZones - going to increase the number later on to have more stuff added to my application.
In each RadDock I have a control
I want to have a DropDownList that will have the closed RadDocks and when selected the will re-open again
the following is my code :
<%
@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="SaveAndLoad.aspx.cs" Inherits="SaveAndLoad" %>
<%
@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
asp:Content ID="Content2" runat="server" contentplaceholderid="ContentPlaceHolder1">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</
asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<telerik:raddocklayout runat="server" enableviewstate="False"
id="RadDockLayout1" onloaddocklayout="RadDockLayout1_LoadDockLayout"
onsavedocklayout="RadDockLayout1_SaveDockLayout"
storelayoutinviewstate="False">
<telerik:raddockzone runat="server" id="RadDockZone2" orientation="vertical"
style="width:300px;min-height:100px;float:left;margin-right:20px;" Width="22px">
<telerik:raddock runat="server" id="RadDock3" title="Databound control"
AutoPostBack="true">
<contenttemplate>
<asp:gridview runat="server" id="GridView1" width="100%">
</asp:gridview>
</contenttemplate>
</telerik:raddock>
</telerik:raddockzone>
<telerik:raddockzone runat="server" id="RadDockZone1" orientation="vertical"
style="width:300px;min-height:100px;float:left;">
<telerik:raddock runat="server" id="RadDock2" title="Text"
text="This is a dock with some text inside" AutoPostBack="true"
CommandsAutoPostBack="True" Skin="Default">
</telerik:raddock>
</telerik:raddockzone>
</telerik:raddocklayout>
</ContentTemplate>
</asp:UpdatePanel>
</
asp:Content>
using
System;
using
System.Collections.Generic;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Collections;
using
System.Web.Script.Serialization;
using
System.Data.SqlClient;
using
Telerik.Web.UI;
using
System.Text;
public
partial class SaveAndLoad : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ArrayList source = new ArrayList();
source.Add(
"one");
source.Add(
"two");
source.Add(
"three");
GridView1.DataSource = source;
GridView1.DataBind();
}
protected void RadDockLayout1_LoadDockLayout(object sender, Telerik.Web.UI.DockLayoutEventArgs e)
{
HttpCookie positionsCookie = Request.Cookies.Get(
"positionsCookie");
if (positionsCookie != null)
{
String serializedList = positionsCookie.Value;
if (serializedList != null)
{
String[] states = serializedList.Split('|');
for (int i = 0; i < states.Length-1; i++)
{
DockState state = DockState.Deserialize(states[i]);
RadDock dock = (RadDock)RadDockLayout1.FindControl(state.UniqueName);
dock.Closed =
false;
dock.ApplyState(state);
e.Positions[state.UniqueName] = state.DockZoneID;
e.Indices[state.UniqueName] = state.Index;
}
}
}
}
protected void RadDockLayout1_SaveDockLayout(object sender, Telerik.Web.UI.DockLayoutEventArgs e)
{
HttpCookie positionsCookie = Request.Cookies.Get(
"positionsCookie");
if (positionsCookie == null | Page.IsPostBack)
{
positionsCookie =
new HttpCookie("positionsCookie");
Page.Response.Cookies.Add(positionsCookie);
List<DockState> stateList = ((RadDockLayout)sender).GetRegisteredDocksState();
StringBuilder serializedList = new StringBuilder();
for (int i = 0; i < stateList.Count; i++)
{
serializedList.Append(stateList[i].ToString());
serializedList.Append(
"|");
}
positionsCookie.Expires =
DateTime.MaxValue;
positionsCookie.Value = serializedList.ToString();
}
}
protected void RadDock2_Command(object sender, DockCommandEventArgs e)
{
}
}
Thanks in advance.