Hi all
I have two radzones and i'm adding the docks dynamically to the zones on button click.
My problem is if add one dock , resize the dock by grabing the dock.
Then I added one more dock then previously added dock not persisting its height instead its getting default height.
How can I avoid this on postback.
pls help as early as possible.
my aspx code.
My code behind
Please help as soon as possible since its urgent for me
I have two radzones and i'm adding the docks dynamically to the zones on button click.
My problem is if add one dock , resize the dock by grabing the dock.
Then I added one more dock then previously added dock not persisting its height instead its getting default height.
How can I avoid this on postback.
pls help as early as possible.
my aspx code.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DashBoard.aspx.cs" Inherits="DashBoard_DashBoard" EnableEventValidation="false"%>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE HTML />
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
>
<
link
href
=
"../css/main.css"
type
=
"text/css"
rel
=
"stylesheet"
/>
<
link
href
=
"../css/jquery-ui.css"
type
=
"text/css"
rel
=
"stylesheet"
/>
<
script
src
=
"../Scripts/jquery.min.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"../Scripts/jquery-ui.min.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"../Scripts/jquery.ui.core.min.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"../Scripts/jquery-ui-1.8.5.custom.min.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"../Scripts/Resize.js"
type
=
"text/javascript"
></
script
>
<
title
>Dashboard</
title
>
<
style
type
=
"text/css"
>
.style1
{
width: 119%;
height: 324px;
}
.style3
{
width: 265px;
height: 284px;
}
.zone
{
overflow:auto;
}
</
style
>
<%-- Css for maximize and minimize button--%>
<
style
type
=
"text/css"
>
body
{
width:100%;
height:97%;
overflow-y:hidden;
}
.rdContent
{
overflow-x:hidden !important;
}
.rdTitleBar em
{
width:auto !important;
}
.max
{
/*change the url of the image */
width: 20px !important;
background: url('../images/maximize.gif') no-repeat !important;
}
.min
{
/*change the url of the image */
width: 20px !important;
background: url('../images/minimize.jpg') no-repeat !important;
}
.style5
{
width: 265px;
height: 182px;
}
.style6
{
width: 265px;
height: 181px;
}
</
style
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
var isMax=false;
var expandDockheight;
window.onresize = resizeDockZones;
function dockInitialize(obj, args) {
OverrideClose();
}
// When a dock is closed, its DockZoneId is stored into the hidden field
function ClientCommand(sender, args) {
if (args.Command.get_name() == "Close")
{
var hiddenField = $get("<%=closedDockZoneId.ClientID %>");
hiddenField.value = sender.get_dockZoneID();
//this code repositions the docks to their zones once a dock is closed
var zones = Telerik.Web.UI.RadDockZonesGlobalArray;
var length = docks.length;
var zonesCount = 0;
for (var i = 0; i <
length
; i++)
{
// if (docks.length == 2)
// {
// if (!docks[i].get_closed()) {
// zones[0].dock(docks[i]);
// zonesCount++;
// }
// }
SwitchCheckBox(docks[i], !docks[i].get_closed());
}
}
}
//Enables/Disables the checkboxes
function SwitchCheckBox(dock, toDisable) {
var
id
=
""
;
switch (dock.get_id())//disable the respective check-box
{
case "1":
id
=
"#chkAlrmSumry"
;
break;
case "2":
id
=
"#chkActCals"
;
break;
case "3":
id
=
"#chkPndCals"
;
break;
case "4":
id
=
"#chkCalActConsole"
;
break;
case "5":
id
=
"#chkDisptchr"
;
break;
case "6":
id
=
"#chkCalActEndpnt"
;
break;
}
EnableDisableCheckBox(id, toDisable);
}
function EnableDisableCheckBox(id, toDisable) {
if (toDisable) {
$(id).attr('checked');
// $(id)[0]
.parentNode.className
=
"aspNetDisabled"
;
}
else {
$(id).removeAttr('checked');
// $(id)[0]
.parentNode.className
=
""
;
}
}
//When the content area of a dock is clicked, page navigation to the desired location must take place
var docks = [];
//When the content area of a dock is clicked, page navigation to the desired location must take place
function Dock_OnClientInitialize(dock, args) {
docks[docks.length] = dock;
var
dockElem
= dock.get_contentContainer(); //get reference to the dock's wrapper element
$addHandler(dockElem, "dblclick", Function.createDelegate(dock, function () {
//if maximized do not redirect
if (this.get_commands().Maximize.get_state() == 2)
return;
switch (this.get_id())//assign different pages to the docks according their title
{
case "1":
window.location
=
"AlarmSummary.aspx"
;
break;
case "2":
window.location
=
"ActiveCalls.aspx"
;
break;
case "3":
window.location
=
"PendingCalls.aspx"
;
break;
case "4":
window.location
=
"CallActivityForConsole.aspx"
;
break;
case "5":
window.location
=
"CallActivityForDispatchr.aspx"
;
break;
case "6":
window.location
=
"CallActivityForEndPnt.aspx"
;
break;
}
}), false);
}
function Dock_resize(dock, args) {
args.Command.set_state(args.Command.get_state() == 1 ? 2 : 1);
}
function noError() {
return true;
}
window.onerror
=
noError
;
//Function for providng maximize and minimize features for the docks
var
dockZoneID
=
""
;
var dockInitialSize = {};
function Dock_OnMaximizeCommand(dock, args) {
if (window.innerHeight != undefined)
var viewportSize = { 'width': window.innerWidth + "px", 'height': window.innerHeight + "px" };
//var viewportSize = { 'width': 750, 'height': 550 };
else
var viewportSize = { 'width': document.documentElement.clientWidth + "px", 'height': document.documentElement.clientHeight + "px" };
//var viewportSize = { 'width': 750, 'height': 550 };
if (args.Command.get_state() == 1) {
//primary state
dockZoneID
= dock.get_dockZoneID(); //store the dockZone where the dock was docked
dock.undock();
//set absolute position manually to workaround a bug in the undock() method
dock.get_element()
.style.position
=
"absolute"
;
//position the dock according to the layout wrapper
dock.set_top("0px");
dock.set_left("0px");
//store original dock size
dockInitialSize.width
= dock.get_element().clientWidth;
dockInitialSize.height
= dock.get_element().clientHeight;
//maximize the dock
dock.set_width(viewportSize.width);
dock.set_height(viewportSize.height);
expandDockheight
=
viewportSize
.height;
//set the state of the command
args.Command.set_state(args.Command.get_state() == 1 ? 2 : 1);
isMax
=
true
;
}
else
{
//alternate state
//restore original dock size
dock.set_width(dockInitialSize.width);
dock.set_height(dockInitialSize.height);
dock._expandedHeight
=
dockInitialSize
.height
if (args.Command.get_state() == 2) {
dock.set_width(dockInitialSize.width);
dock.set_height(dockInitialSize.height);
}
try {
dockZoneID
= dock._dockZone.get_clientID() == null ? "" : dock._dockZone.get_clientID();
}
catch (exception) {
if (dockZoneID) {
$find(dockZoneID).dock(dock);
}
}
if (dockZoneID) {
$find(dockZoneID).dock(dock);
}
//dock the dock to its zone
//set the state of the command
args.Command.set_state(args.Command.get_state() == 1 ? 2 : 1);
isMax
=
false
;
dock.doPostBack(args.Command.get_name());
}
}
function pageLoad() {
resizeDockZones();
}
function resizeDockZones() {
var viewPortSize = $telerik.getViewPortSize();
var dockZone1 = $find("<%=RadDockZone1.ClientID %>");
var dockZone2 = $find("<%=RadDockZone2.ClientID %>");
resizeZones(dockZone1, dockZone2, viewPortSize);
}
function OnresizeEnd(dock, args) {
return dock._height;
}
</
script
>
<
style
id
=
"dockStyles"
type
=
"text/css"
runat
=
"server"
>
</
style
>
</
telerik:RadCodeBlock
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
visible
=
"True"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
div
id
=
"modalRightCenterContent"
style
=
"display: none; background-color:white; border-color:red; border-style:solid; border-width:1px;"
>
<
div
class
=
"contentTableHeading"
>
<
asp:CheckBox
ID
=
"chkAlrmSumry"
runat
=
"server"
/>
<
asp:Label
ID
=
"alrmSuryLbl"
runat
=
"server"
Text
=
"Alarm Summary"
ForeColor
=
"#122480"
/><
br
/>
<
asp:CheckBox
ID
=
"chkActCals"
runat
=
"server"
/>
<
asp:Label
ID
=
"actCalLbl"
runat
=
"server"
Text
=
"Active Calls"
ForeColor
=
"#122480"
/><
br
/>
<
asp:CheckBox
ID
=
"chkPndCals"
runat
=
"server"
/>
<
asp:Label
ID
=
"pndCalLbl"
runat
=
"server"
Text
=
"Pending Calls"
ForeColor
=
"#122480"
/><
br
/>
<
asp:CheckBox
ID
=
"chkCalActConsole"
runat
=
"server"
/>
<
asp:Label
ID
=
"calActCnslLbl"
runat
=
"server"
Text
=
"Call Activity for Active Consoles"
ForeColor
=
"#122480"
/><
br
/>
<
asp:CheckBox
ID
=
"chkDisptchr"
runat
=
"server"
/>
<
asp:Label
ID
=
"calActDisptrLbl"
runat
=
"server"
Text
=
"Call Activity for Active Dispatchers"
ForeColor
=
"#122480"
/><
br
/>
<
asp:CheckBox
ID
=
"chkCalActEndpnt"
runat
=
"server"
/>
<
asp:Label
ID
=
"calActEndpntLbl"
runat
=
"server"
Text
=
"Call Activity for Active Endpoints"
ForeColor
=
"#122480"
/><
br
/>
</
div
>
<
div
class
=
"buttonHolder"
>
<%-- <
input
type
=
"button"
id
=
"btnAdd"
value
=
""
class
=
"btnMedium "
/>--%>
<
asp:Button
ID
=
"btnAdd"
runat
=
"server"
CssClass
=
"btnMedium"
/>
<
input
type
=
"button"
id
=
"btnCancel"
value
=
""
class
=
"btnSmall marginActionButton"
title
=
"Cancel"
/>
</
div
>
</
div
>
<
input
id
=
"lnkPopup"
type
=
"button"
class
=
"btnVeryBig"
value
=
""
title
=
"Add Widget"
/>
<
telerik:RadDockLayout
runat
=
"server"
ID
=
"RadDockLayout1"
OnSaveDockLayout
=
"RadDockLayout1_SaveDockLayout"
EnableViewState
=
"false"
>
<
div
style
=
"width:99%; height:95%;"
>
<
br
/>
<
asp:Table
ID
=
"Table1"
runat
=
"server"
Width
=
"100%"
>
<
asp:TableRow
>
<
asp:TableCell
Width
=
"50%"
Height
=
"95%"
>
<
telerik:RadDockZone
ID
=
"RadDockZone1"
runat
=
"server"
Orientation
=
"Vertical"
CssClass
=
"zone"
BorderColor
=
"#d7d7d7"
>
</
telerik:RadDockZone
>
</
asp:TableCell
>
<
asp:TableCell
Width
=
"50%"
Height
=
"95%"
>
<
telerik:RadDockZone
ID
=
"RadDockZone2"
runat
=
"server"
CssClass
=
"zone"
Orientation
=
"Vertical"
BorderColor
=
"#d7d7d7"
>
</
telerik:RadDockZone
>
</
asp:TableCell
>
</
asp:TableRow
>
</
asp:Table
>
</
div
>
</
telerik:RadDockLayout
>
<
asp:HiddenField
runat
=
"server"
ID
=
"closedDockZoneId"
/>
<%--stores the id of the RadDockZone, which holds the closed RadDock--%>
<%--Here goes the javascript for the popup--%>
<
script
language
=
"javascript"
type
=
"text/javascript"
>
var popup = 0;
$("#modalRightCenterContent").dialog({
minHeight: 48,
minWidth: 470,
resizable: false,
modal: true,
autoOpen: false,
title: "Add Widgets"
})
.parents(".ui-dialog").find(".ui-dialog-titlebar")
.removeClass("ui-widget-header").addClass("titleBar");
$("#lnkPopup").click(function () {
$("#modalRightCenterContent").dialog('open');
});
$("#btnCancel").click(function () {
$("#modalRightCenterContent").dialog('close');
});
$("#btnAdd").click(function () {
document.location.href = "DashBoard.aspx?Dock1Val=" + chkAlrmSumry.checked + "&Dock2Val=" + chkActCals.checked + "&Dock3Val=" + chkPndCals.checked + "&Dock4Val=" + chkCalActConsole.checked + "&Dock5Val=" + chkDisptchr.checked + "&Dock6Val=" + chkCalActEndpnt.checked + "";
$("#modalRightCenterContent").dialog('close');
$("#chkAlrmSumry").removeAttr('checked');
$("#chkActCals").removeAttr('checked');
$("#chkPndCals").removeAttr('checked');
$("#chkCalActConsole").removeAttr('checked');
$("#chkDisptchr").removeAttr('checked');
$("#chkCalActEndpnt").removeAttr('checked');
});
</
script
>
</
form
>
</
body
>
</
html
>
// ----------------------------------------
// Copyright 2011 Avtec (Inc)
//
// This File has the implementation of DashBoard class methods.
//
// Workfile: DashBoard.aspx.cs
// Revision: 1.0
// Modified: 06/27/2011
// All rights reserved. Copying, compilation, modification, distribution
// or any other use whatsoever of this material is strictly prohibited
// without the written consent of Avtec Inc.
// ----------------------------------------
/****************************************************************************/
/*!
*
* @file DashBoard.aspx.cs
*
* @brief Implements the Dashboard functionality
*
*/
/****************************************************************************/
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Telerik.Web.UI;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Web.Script.Serialization;
using System.Collections.ObjectModel;
using Avtec.DiagnosticLogger;
/****************************************************************************/
/*!
* @brief Implements the funtionality related to widgets in the Dashboard tab.
*
*/
/****************************************************************************/
public partial class DashBoard_DashBoard : System.Web.UI.Page
{
////////////////////////////////////////////////////
//
//!func Page_Load()
//
//!output param - None
//
//!input param - object,EventArgs
//
//!brief -
//
/////////////////////////////////////////////////////
bool[] Dock_flag = { false, false, false, false, false, false };
bool[] chkBxStats = new bool[6];
static string[] zoneIds= new string[6] { "", "", "", "", "", "" };
string result_dock = "";
static public string consleDocTitle;
static public string disptrDocTitle;
static public string endPntDocTitle;
Business bsl;
#region Properties
private List<
DockState
> CurrentDockStates
{
get
{
// Store the info about the added docks in the session.
List<
DockState
> _currentDockStates = (List<
DockState
>)Session["CurrentDockStatesDynamicDocks"];
if (Object.Equals(_currentDockStates, null))
{
_currentDockStates = new List<
DockState
>();
Session["CurrentDockStatesDynamicDocks"] = _currentDockStates;
}
return _currentDockStates;
}
set
{
Session["CurrentDockStatesDynamicDocks"] = value;
}
}
#endregion
#region Protected Methods
protected override void OnInit(EventArgs e)
{
string dockZneID = "";
if (Session["DockFlags"] != null)
{
Dock_flag = (bool[])Session["DockFlags"];
}
for (int i = 0; i <
CurrentDockStates.Count
; i++)
{
if (CurrentDockStates[i].Closed == false)
{
RadDock
dock
=
CreateRadDockFromState
(CurrentDockStates[i]);
RadDockLayout1.Controls.Add(dock);
CreateSaveStateTrigger(dock);
dock.Closed
=
false
;
}
}
if (!Page.IsPostBack)
{
for (int
i
=
1
; i <= 6; i++)
{
result_dock
=
Request
.QueryString["Dock" + i.ToString() + "Val"];
if (result_dock != null && !result_dock.Equals(""))
{
if (result_dock.Equals("true") && Dock_flag[i - 1] == false)
{
RadDock
dock
=
CreateRadDock
(i);
AddToEmptyRadDock(dock);
CreateSaveStateTrigger(dock);
Dock_flag[i - 1] = true;
Session["DockFlags"] = Dock_flag;
dock.Closed
=
false
;
zoneIds[i - 1] = dock.DockZoneID;
}
}
}
}
for (int
i
=
1
; i <= 6; i++)
{
if (Session["ZoneIds"] != null)
{
zoneIds = (string[])Session["ZoneIds"];
}
result_dock
=
Request
.QueryString["Dock" + i.ToString() + "Val"];
dockZneID
=
zoneIds
[i - 1] == null ? "" : zoneIds[i - 1];
if (result_dock == "false" && !dockZneID.Equals(""))
{
removeDock(i, dockZneID);
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
setDockName();
}
//
refreshTimer.Interval
=
10
* 6 * 200;
}
#endregion
#region Private Methods
private void setDockName()
{
DataAccess
accessData
=
new
DataAccess();
Business
bsl
=
new
Business();
try
{
int[]
values
=
accessData
.getXYvalues();
consleDocTitle
=
"Call Activity for "
+ values[1] + " Consoles for past " + values[0] + " hours";
disptrDocTitle
=
"Call Activity for "
+ values[1] + " Dispatchers for past " + values[0] + " hours";
endPntDocTitle
=
"Call Activity for "
+ values[1] + " Endpoints for past " + values[0] + " hours";
}
catch (Exception exception)
{
bsl.LogException("Page_load", exception.Message, "DashBoard.aspx.cs");
}
finally
{
accessData
=
null
;
bsl
=
null
;
}
}
private void AddToEmptyRadDock(RadDock dock)
{
if (RadDockZone1.Docks.Count == 0)
{
RadDockZone1.Controls.Add(dock);
}
else
if (RadDockZone2.Docks.Count == 0)
{
RadDockZone2.Controls.Add(dock);
}
else
if (RadDockZone1.Docks.Count < 3 && !(RadDockZone1.Docks.Count > RadDockZone2.Docks.Count))
{
RadDockZone1.Controls.Add(dock);
}
else
if (RadDockZone2.Docks.Count <
3
)
{
RadDockZone2.Controls.Add(dock);
}
}
private RadDock CreateRadDockFromState(DockState state)
{
string
docks
=
CurrentDockStates
[0].DockZoneID;
RadDock
dock
=
new
RadDock();
dock.DockMode
= DockMode.Default;
dock.EnableAnimation
=
true
;
dock.EnableRoundedCorners
=
true
;
dock.EnableEmbeddedSkins
=
true
;
dock.TitlebarContainer.BorderColor
=
System
.Drawing.ColorTranslator.FromHtml("#548264");
dock.UniqueName
=
state
.UniqueName;
dock.ID
=
string
.Format("RadDock{0}", state.UniqueName);
dock.ApplyState(state);
dock.Resizable
=
true
;
dock.Skin
=
"Outlook"
;
DockCloseCommand
closeCommand
=
new
DockCloseCommand();
closeCommand.AutoPostBack
=
true
;
DockExpandCollapseCommand
expandCommand
=
new
DockExpandCollapseCommand();
expandCommand.AutoPostBack
=
false
;
DockToggleCommand
maximizeCommand
=
new
DockToggleCommand();
maximizeCommand.Name
=
"Maximize"
;
maximizeCommand.Text
=
"Maximize"
;
maximizeCommand.OnClientCommand
=
"Dock_OnMaximizeCommand"
;
maximizeCommand.AlternateText
=
"Restore"
;
maximizeCommand.CssClass
=
"max"
;
maximizeCommand.AlternateCssClass
=
"min"
;
//assign client-side event handler
dock.OnClientInitialize
=
"Dock_OnClientInitialize"
;
dock.OnClientCommand
=
"ClientCommand"
;
dock.ContentContainer.Style.Add(HtmlTextWriterStyle.OverflowX, "hidden");
dock.TitlebarContainer.HorizontalAlign
= HorizontalAlign.Left;
dock.OnClientResizeEnd
=
"OnresizeEnd"
;
setDockName();
switch (state.Tag)
{
case "1":
Control
widget
=
LoadControl
("Controls/AlarmSummaryCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock1_Command);
dock.ID
=
"1"
;
dock.Title
=
"Alarm Summary"
;
dock.ContentContainer.Controls.Add(widget);
break;
case "2":
widget
=
LoadControl
("Controls/ActiveCallsCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock2_Command);
dock.ID
=
"2"
;
dock.Title
=
"Active Calls"
;
dock.ContentContainer.Controls.Add(widget);
break;
case "3":
widget
=
LoadControl
("Controls/PendingCallsCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock3_Command);
dock.ID
=
"3"
;
dock.Title
=
"Pending Calls"
;
dock.ContentContainer.Controls.Add(widget);
break;
case "4":
widget
=
LoadControl
("Controls/CallActivityForConsoleCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock4_Command);
dock.ID
=
"4"
;
dock.Title
=
consleDocTitle
;
dock.ContentContainer.Controls.Add(widget);
break;
case "5":
widget
=
LoadControl
("Controls/CallActivityForDispatchrCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock5_Command);
dock.ID
=
"5"
;
dock.Title
=
disptrDocTitle
;
dock.ContentContainer.Controls.Add(widget);
break;
case "6":
widget
=
LoadControl
("Controls/CallActivityForEndPntCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock6_Command);
dock.ID
=
"6"
;
dock.Title
=
endPntDocTitle
;
dock.ContentContainer.Controls.Add(widget);
break;
}
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.Commands.Add(expandCommand);
return dock;
}
private RadDock CreateRadDock(int i)
{
RadDock
dock
=
new
RadDock();
dock.DockMode
= DockMode.Default;
dock.EnableAnimation
=
true
;
dock.EnableRoundedCorners
=
true
;
dock.EnableEmbeddedSkins
=
true
;
dock.TitlebarContainer.BorderColor
=
System
.Drawing.ColorTranslator.FromHtml("#548264");
dock.TitlebarContainer.HorizontalAlign
= HorizontalAlign.Left;
dock.Resizable
=
true
;
dock.UniqueName
=
Guid
.NewGuid().ToString();
dock.ID
=
string
.Format("RadDock{0}", dock.UniqueName);
switch (i)
{
case 1:
dock.ID
=
"1"
;
dock.Tag
=
"1"
;
break;
case 2:
dock.ID
=
"2"
;
dock.Tag
=
"2"
;
break;
case 3:
dock.ID
=
"3"
;
dock.Tag
=
"3"
;
break;
case 4:
dock.ID
=
"4"
;
dock.Tag
=
"4"
;
break;
case 5:
dock.ID
=
"5"
;
dock.Tag
=
"5"
;
break;
case 6:
dock.ID
=
"6"
;
dock.Tag
=
"6"
;
break;
}
dock.Height
=
Unit
.Pixel(165);
dock.Width
=
Unit
.Pixel(460);
//assign client-side event handler
dock.OnClientInitialize
=
"Dock_OnClientInitialize"
;
DockCloseCommand
closeCommand
=
new
DockCloseCommand();
closeCommand.AutoPostBack
=
true
;
DockExpandCollapseCommand
expandCommand
=
new
DockExpandCollapseCommand();
dock.OnClientCommand
=
"ClientCommand"
;
DockToggleCommand
maximizeCommand
=
new
DockToggleCommand();
maximizeCommand.Name
=
"Maximize"
;
maximizeCommand.Text
=
"Maximize"
;
maximizeCommand.OnClientCommand
=
"Dock_OnMaximizeCommand"
;
maximizeCommand.AlternateText
=
"Restore"
;
maximizeCommand.CssClass
=
"max"
;
maximizeCommand.AlternateCssClass
=
"min"
;
dock.ContentContainer.Style.Add(HtmlTextWriterStyle.OverflowX, "hidden");
dock.Skin
=
"Outlook"
;
switch (dock.ID)
{
case "1":
Control
widget
=
LoadControl
("~/DashBoard/Controls/AlarmSummaryCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock1_Command);
dock.ContentContainer.Controls.Add(widget);
dock.Title
=
"Alarm Summary"
;
break;
case "2":
widget
=
LoadControl
("~/DashBoard/Controls/ActiveCallsCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock2_Command);
dock.Title
=
"Active Calls"
;
dock.ContentContainer.Controls.Add(widget);
break;
case "3":
widget
=
LoadControl
("~/DashBoard/Controls/PendingCallsCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock3_Command);
dock.Title
=
"Pending Calls"
;
dock.ContentContainer.Controls.Add(widget);
break;
case "4":
widget
=
LoadControl
("~/DashBoard/Controls/CallActivityForConsoleCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock4_Command);
dock.Title
=
consleDocTitle
;
dock.ContentContainer.Controls.Add(widget);
break;
case "5":
widget
=
LoadControl
("~/DashBoard/Controls/CallActivityForDispatchrCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock5_Command);
dock.Title
=
disptrDocTitle
;
dock.ContentContainer.Controls.Add(widget);
break;
case "6":
widget
=
LoadControl
("~/DashBoard/Controls/CallActivityForEndPntCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock6_Command);
dock.Title
=
endPntDocTitle
;
dock.ContentContainer.Controls.Add(widget);
break;
}
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.Commands.Add(expandCommand);
return dock;
}
private void CreateSaveStateTrigger(RadDock dock)
{
dock.AutoPostBack
=
true
;
dock.CommandsAutoPostBack
=
false
;
}
private void Refresh(CheckBox chkbox, int index)
{
Dock_flag[index] = false;
chkbox.Checked
=
false
;
zoneIds[index] = "";
}
private void removeDock(int dockid, string zoneID)
{
bsl
=
new
Business();
if (!zoneID.Equals(""))
{
if (zoneID == "RadDockZone1")
{
try
{
RadDock dock = (from s in RadDockZone1.Docks
where s.Tag == dockid.ToString()
select s).First();
deleteDock(dockid, RadDockZone1, dock);
}
catch (Exception exception1)
{
RadDock dock = (from s in RadDockZone2.Docks
where s.Tag == dockid.ToString()
select s).First();
deleteDock(dockid, RadDockZone2, dock);
}
}
else
{
try
{
RadDock dock = (from s in RadDockZone2.Docks
where s.Tag == dockid.ToString()
select s).First();
deleteDock(dockid,RadDockZone2,dock);
}
catch (Exception exception2)
{
RadDock dock = (from s in RadDockZone1.Docks
where s.Tag == dockid.ToString()
select s).First();
deleteDock(dockid, RadDockZone1, dock);
}
}
}
switch (dockid)
{
case 1:
chkAlrmSumry.Checked
=
false
;
break;
case 2:
chkActCals.Checked
=
false
;
break;
case 3:
chkPndCals.Checked
=
false
;
break;
case 4:
chkCalActConsole.Checked
=
false
;
break;
case 5:
chkDisptchr.Checked
=
false
;
break;
case 6:
chkCalActEndpnt.Checked
=
false
;
break;
}
bsl
=
null
;
}
private void deleteDock(int dockid,RadDockZone zone,RadDock dock)
{
zone.Docks.Remove(dock);
zone.Controls.Remove(dock);
dock.Closed
=
true
;
zoneIds[dockid - 1] = "";
Dock_flag[dockid - 1] = false;
}
private void enableChhbx(int dockid)
{
switch (dockid)
{
case 1:
chkAlrmSumry.Checked
=
true
;
break;
case 2:
chkActCals.Checked
=
true
;
break;
case 3:
chkPndCals.Checked
=
true
;
break;
case 4:
chkCalActConsole.Checked
=
true
;
break;
case 5:
chkDisptchr.Checked
=
true
;
break;
case 6:
chkCalActEndpnt.Checked
=
true
;
break;
}
}
#endregion
#region Control Events
protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)
{
CurrentDockStates
=
new
List<DockState>();
var docks = RadDockLayout1.RegisteredDocks;
foreach (DockState ds in RadDockLayout1.GetRegisteredDocksState())
{
CurrentDockStates.Add(ds);
}
for (int i = 0; i < CurrentDockStates.Count; i++)
{
// zoneIds[i] = CurrentDockStates[i].DockZoneID;
}
Session["DockFlags"] = Dock_flag;
for(int i=1;i<=6;i++)
{
if (Dock_flag[i - 1] == true)
{
enableChhbx(i);
}
}
}
protected void Dock1_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Refresh(chkAlrmSumry, 0);
}
}
protected void Dock2_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Refresh(chkActCals, 1);
}
}
protected void Dock3_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Refresh(chkPndCals, 2);
}
}
protected void Dock4_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Refresh(chkCalActConsole, 3);
}
}
protected void Dock5_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Refresh(chkDisptchr, 4);
}
}
protected void Dock6_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Refresh(chkCalActEndpnt, 5);
}
}
#endregion
}