Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
94 views
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.
<%@ 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 />
  
<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>
My code behind
// ----------------------------------------
//  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    
}
Please help as soon as possible since its urgent for me
Ram
Top achievements
Rank 1
 answered on 12 Nov 2011
5 answers
158 views
Hi.
I tested the RadRating with a RadGrid and the time to show
results displays two lines of RadRating to select and the other with the assigned value.

As I show only the value of RadRating?

Thanks.

<telerik:RadGrid runat="server" ID="gridResults" AllowPaging="true" GridLines="None" OnItemDataBound="ResultsItemDataBound" AutoGenerateColumns="false" PageSize="10" Width= "570px" 
AllowSorting="true">
<ItemStyle BackColor="White" BorderColor="White" BorderWidth="0px" />
<AlternatingItemStyle BackColor="White" BorderColor="White" BorderWidth="0px" />
<MasterTableView TableLayout="Fixed" BackColor="White" BorderColor="White" BorderStyle="None"
BorderWidth="0px" AllowCustomSorting="true">
    <ItemTemplate>
         <asp:Label ID="lblId" Visible="false" Text='<%#Eval("Id")%>' runat="server" />
            <div class="itemGrid">
                 <div class="cadena">
                   <asp:Image runat="server" ID="imgCadena" Visible="true" Height="75px" Width="75px" 
                        style="margin-left:12px;" ImageAlign="Left" ImageUrl='<%#Eval("thumb") %>'/><br />                                
                  </div>                            
                  <div class="hotel">                            
                  <asp:Label ID="lblHotel" runat="server" Text='<%#Eval("name") %>'></asp:Label>
                  <br />
                  <asp:Label ID="lblDesc" runat="server" Font-Size="XX-Small" ForeColor="Silver" Text='<%#Eval("desc") %>'>
                   </asp:Label>
                   </div>                                                       
                   <div class="Stars">
                   <br />
                   <div style="text-align:center; float:left;">
                   <telerik:RadRating ID="RadRating1" runat="server" DBValue='<%#Eval("starsLevel")%>' />
                   </div>                            
                   <asp:Label ID="lblStars" runat="server"></asp:Label> <br />
                   </div>
                   <div class="precio">
                   <br />                            
                   <asp:Label ID="lblFare" runat="server" style="font-weight:bold" />
                   <br />
                   <div id="divComprar" runat="server" clientidmode="Static">                            
                   <telerik:RadButton ID="btnComprar" runat="server" Height="56px" Width="75px" Text="Comprar"
                           ForeColor="White" OnClick="BtnComprar_OnClick" Image-IsBackgroundImage="true"
                    Image-HoveredImageUrl="~/Images/btnBuscarHovered.png" Image-ImageUrl="~/Images/btnBuscar.png" >
                   </telerik:RadButton>
                   </div>                                                        
                   </div>                                            
                    </ItemTemplate>
                    <Columns>
                           //etc. 
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
Roberts
Top achievements
Rank 1
 answered on 11 Nov 2011
1 answer
85 views
Is there any way to bind the checked/unchecked status of the listbox checkboxes from the datasource?
Thanks.
Dan
Dan
Top achievements
Rank 2
 answered on 11 Nov 2011
0 answers
57 views
Hello!
I have a RadRibbonBar in Master Page, and RadGrid in Details.
RadGrid contains

  <telerik:GridTemplateColumn  UniqueName="Select" HeaderStyle-Width="3%"  AllowFiltering="false">
                          
                          <ItemTemplate>
                           <asp:CheckBox  id="chkSelect" runat="server"  />
                          </ItemTemplate>
                          
                       </telerik:GridTemplateColumn>

When user click on Export button, I need Get all rows selected in RadGrid. And export to XLS.

I dont kwon how access to selected Rows from radribbonBar :-)

thanks!

july
July
Top achievements
Rank 2
 asked on 11 Nov 2011
3 answers
168 views
Hi,

I'm having trouble with my RadGrid - whenever I try editing an item the row isn't put into edit mode and instead all the data is lost from the Grid.  I have AllowAutomaticUpdates set to true, and am using the NeedDataSource method.

My aspx code:
<telerik:RadGrid ID="SubmittedApplicantsRadGrid" runat="server" GridLines="Both" AutoGenerateColumns="False" OnNeedDataSource="SubmittedApplicantsRadGrid_NeedDataSource" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true">
    <ValidationSettings ValidationGroup="SubmittedApplicants"></ValidationSettings>
    <MasterTableView DataKeyNames="Id" EditMode="InPlace" CommandItemDisplay="None" NoMasterRecordsText="No applicants submitted to this job">
    <Columns>       
        <telerik:GridBoundColumn DataField="ApplicantName.Title" DataType="System.String" ReadOnly="true" HeaderText="Name" UniqueName="Name"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="PayRate" DataType="System.Double" DataFormatString="{0:C}" ReadOnly="true" HeaderText="Pay Rate" UniqueName="PayRate"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="BillRate" DataType="System.Double" DataFormatString="{0:C}" ReadOnly="true" HeaderText="Bill Rate" UniqueName="BillRate"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ApplicantName.Class" DataType="System.String" ReadOnly="true" HeaderText="Employee Class" UniqueName="Class"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="SubmittedBy.Title" DataType="System.String" ReadOnly="true" HeaderText="Submitted By" UniqueName="SubmittedBy"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="SubmittedDate" DataType="System.DateTime"  ReadOnly="true" HeaderText="Submitted On" UniqueName="SubmittedDate"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ForwardedBy.Title" DataType="System.String" ReadOnly="true" HeaderText="Forwarded By" UniqueName="ForwardedBy"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ForwardedDate" DataType="System.DateTime" ReadOnly="false" HeaderText="Forwarded On" UniqueName="ForwardedDate"></telerik:GridBoundColumn>
        <telerik:GridCheckBoxColumn DataField="Interviewed" DataType="System.Boolean" ReadOnly="false" HeaderText="Interviewed?" UniqueName="Interviewed"></telerik:GridCheckBoxColumn>
 
        <telerik:GridEditCommandColumn ButtonType="ImageButton">
            <ItemStyle Wrap="False" Width="28px" />
        </telerik:GridEditCommandColumn>
    </Columns>
 
    <EditFormSettings>
        <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
    </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>

And my C# code:
protected void SubmittedApplicantsRadGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    EntityList<ApplicantsSubmittedJobsItem> ApplicantsSubmittedJobs = data.GetList<ApplicantsSubmittedJobsItem>("ApplicantsSubmittedJobs");
 
    var applicantSubmittedJobs = from applicantSubmittedJob in ApplicantsSubmittedJobs
                                 select applicantSubmittedJob;
 
    SubmittedApplicantsRadGrid.DataSource = applicantSubmittedJobs;
}

Any help you could provide would be much appreciated.

Thanks!
Tarkon
Top achievements
Rank 1
 answered on 11 Nov 2011
6 answers
124 views

I have a TreeList with text columns and checkbox columns. Is there a way to allow the checkboxes to be clicked and change state in the TreeList and display a popup dialog for text editing?

Paul
Top achievements
Rank 1
 answered on 11 Nov 2011
3 answers
98 views
Hello

I've been able to set some properties like header, footer, margins, orientation, etc but I got stuck on others:
- header/footer right alignment
- PaperSize property
- PrintHeadings property
- Zoom property
- set scaling to "fit all columns on one page".

Any help will be greatly appreciated.
Daniel
Telerik team
 answered on 11 Nov 2011
5 answers
107 views
Hello,

For anyone out there using IE 9 and version 2010.1.519.35 ASP .NET I think I may have found a bug. Now I am not sure if this is a Telerik or Msoft issue but it is there either way. The drag and drop capability was not working between the two list boxes. Had me pulling my hair out till I tried other IE versions along with Safari and Firefox. The code below worked in every way except for drag and drop and the Server side API event were not firing.

<td>
     <telerik:RadListBox ID="AvailableRolesListBox" runat="server" Height="200" DataTextField="DisplayName" DataValueField="RoleId" CssClass="AvailableRolesListBox" SelectionMode="Multiple" AllowTransfer="true" TransferToID="SelectedRolesListBox" OnTransferred="RadListBox_Transferred" AutoPostBackOnTransfer="true" EnableDragAndDrop="true" AllowTransferOnDoubleClick="true" OnDropped="RadListBox_Dropped" Skin="WebBlue" />
</td>
 
<td>
       
</td>
                     
<td>
     <telerik:RadListBox ID="SelectedRolesListBox" runat="server" Height="200" DataTextField="DisplayName" DataValueField="RoleId" CssClass="SelectedRolesListBox" SelectionMode="Multiple" AllowTransfer="true" TransferToID="AvailableRolesListBox" OnTransferred="RadListBox_Transferred" AutoPostBackOnTransfer="true" EnableDragAndDrop="true" AllowTransferOnDoubleClick="true" OnDropped="RadListBox_Dropped" Skin="WebBlue" />
</td>


As I mentioned earlier I don't know if this is a problem with IE or Telerik and I know that Telerik has a newer release of the ASP .NET controls and hopefully by Q4 I can get this very large site upgraded to them. This post is mostly to help anyone out there hitting the same wall and Goggling for help.

JB
federic batista
Top achievements
Rank 1
 answered on 11 Nov 2011
1 answer
79 views
Hi telerik team,

I need a clarification in add custom drop down.
When i add custom drop down via code behind,only able to see the custom drop down only.

Instead of that ,Is any possibility to add custom dropdown in that full set of tools. If possible,share any idea to proceed.

Expecting your valuable suggestions.

Thank you.
Rumen
Telerik team
 answered on 11 Nov 2011
2 answers
50 views
Currently, the date is a Link, and I don't want it to be.  How do I disable that?
Peter
Telerik team
 answered on 11 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?