This is a migrated thread and some comments may be shown as answers.

Closed Dock How to open?!

3 Answers 125 Views
Dock
This is a migrated thread and some comments may be shown as answers.
A.mass
Top achievements
Rank 1
A.mass asked on 09 Apr 2009, 10:09 AM


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.                    

3 Answers, 1 is accepted

Sort by
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 09 Apr 2009, 10:19 AM
A closed RadDock is simply hidden on the page. You could show it via RadDock.set_closed() JavaScript method, e.g.
$find("RadDockClientID").set_closed(false);
A simple example which illustrates set_closed method is available here:
http://demos.telerik.com/aspnet-ajax/dock/examples/clientsideapi/defaultcs.aspx
Hope this helps.


0
A.mass
Top achievements
Rank 1
answered on 09 Apr 2009, 10:40 AM

Thanks alot for your fast response.

But is there anyway to do that at page-behind code ?!

Thanks again.
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 09 Apr 2009, 11:33 AM
Try to set  dock.Closed = false after LoadLayout event, e.g. PageLoad or in DropDown.OnSelectedindexChanged handler.
Tags
Dock
Asked by
A.mass
Top achievements
Rank 1
Answers by
Obi-Wan Kenobi
Top achievements
Rank 1
A.mass
Top achievements
Rank 1
Share this question
or