Index of Range issue Raddock

5 posts, 0 answers
  1. Ram
    Ram avatar
    97 posts
    Member since:
    Jun 2011

    Posted 14 Sep 2011 Link to this post

    Hi
    In my application I'm using raddocks.
    Im having total  6 dockzones and 6 docks.
    I'm loading the usercontrols(with radgrid) in every dock.
    After loading the docks.
    If I close the first dock then second dock will move to fisrt and third to second and so on....
    But when I closed first one its ok, but if I closed the second I'm getting the error like as below

    "Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index."
    If I load docks with out radgrids ie only with empty usercontrols then its fine.
    If I add the first consequent three alone or last three  consequent  alone its working fine.
    Please do the needful its urgent for me.

    Dashboard.aspx

    <%@ 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>
        <title>Dashboard</title>
        <style type="text/css">
            .style1
            {
                width: 119%;
                height: 324px;
            }
            .style3
            {
                width: 265px;
                height: 284px;
            }
        </style>
        <%-- Css for maximize and minimize button--%>
        <style type="text/css">
            .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 isMaxmized = false;
                var dockMax = false;
                var dockZone;
                var sessionValue = '<%= Session["event"] %>';
      
                if (sessionValue == "sorting") 
                {
                    isMaxmized = true;
                    var dockMax = true;
                }
      
                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();
                        isMaxmized = false;
                    }
                }
                  
                //When the content area of a dock is clicked, page navigation to the desired location must take place
                function Dock_OnClientInitialize(dock, args) {
                     
                    var dockElem = dock.get_contentContainer();  //get reference to the dock's wrapper element
                    $addHandler(dockElem, "click", function () {
      
                        if (isMaxmized) {
                            return;
                        }
                        switch (dock.get_title())//assign different pages to the docks according their title
                        {
                            case "Alarm Summary":
                                window.location = "AlarmSummary.aspx";
                                break;
                            case "Active Calls":
                                window.location = "ActiveCalls.aspx";
                                break;
                            case "Pending Calls":
                                window.location = "PendingCalls.aspx";
                                break;
                            case "Call Activity for Active Consoles":
                                window.location = "CallActivityForConole.aspx";
                                break;
                            case "Call Activity for Active Dispatchers":
                                window.location = "CallActivityForDispatchr.aspx";
                                break;
                            case "Call Activity for Active Endpoints":
                                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 (dockMax==false) {
                        //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);
                        //set the state of the command
                        args.Command.set_state(args.Command.get_state() == 1 ? 2 : 1);
                        isMaxmized = true;
                        dockMax = true;
                      //  command.set_state(1);
                    }
                    else {
                        //alternate state
                        //restore original dock size
      
                        if (dockInitialSize.width != undefined && dockInitialSize.height != undefined) {
                            dock.set_width(dockInitialSize.width);
                            dock.set_height(dockInitialSize.height);
                        }
      
                        else 
                        {
                            dock.set_width(300);
                            dock.set_height(175);
                        }
      
                        if (dockZoneID == "") 
                        {
                            var zoneid =dock.get_title()
                            $find("RadDockZone1").dock(dock);
                        }
      
                        else
                        {
                            $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);
                        isMaxmized = false;
                        dockMax = false;
                        //command.set_state(2);
                    }
                }
      
                 
            </script>
            <style id="dockStyles" type="text/css" runat="server">
                  
            </style>
        </telerik:RadCodeBlock>
    </head>
    <body>
        <form id="form1" runat="server" visible="True">
           
        <input id="lnkPopup" type="button" class="btnVeryBig" value="" title="Add Widget"/>
        <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="Label1" 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 " title="Add Widget" />            
                <input type="button" id="btnCancel" value="" class="btnSmall marginActionButton"
                    title="Cancel" />
            </div>
        </div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadDockLayout1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="chkAlrmSumry" LoadingPanelID="DefaultLoadingPanelID "
                            UpdatePanelRenderMode="Inline" />
                        <telerik:AjaxUpdatedControl ControlID="chkActCals" LoadingPanelID="DefaultLoadingPanelID "
                            UpdatePanelRenderMode="Inline" />
                        <telerik:AjaxUpdatedControl ControlID="chkPndCals" LoadingPanelID="DefaultLoadingPanelID "
                            UpdatePanelRenderMode="Inline" />
                        <telerik:AjaxUpdatedControl ControlID="chkCalActConsole" LoadingPanelID="DefaultLoadingPanelID "
                            UpdatePanelRenderMode="Inline" />
                       <telerik:AjaxUpdatedControl ControlID="chkDisptchr" LoadingPanelID="DefaultLoadingPanelID "
                            UpdatePanelRenderMode="Inline" />
                        <telerik:AjaxUpdatedControl ControlID="chkCalActEndpnt" LoadingPanelID="DefaultLoadingPanelID "
                            UpdatePanelRenderMode="Inline" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <asp:UpdatePanel ID="Panel1" runat="server" Visible="True">
            <ContentTemplate>
                <telerik:RadDockLayout runat="server" ID="RadDockLayout1" OnLoadDockLayout="RadDockLayout1_LoadDockLayout"
                    OnSaveDockLayout="RadDockLayout1_SaveDockLayout">
                    <div style="width: 100%;">
                        <div align="left" style="width: 72%; float: left">
                            <table align="left" class="style1">
                                <tr>
                                    <td class="style6">
                                        <telerik:RadDockZone ID="RadDockZone1" runat="server" Height="165px" Width="300px">
                                        </telerik:RadDockZone>
                                    </td>
                                    <td class="style6">
                                        <telerik:RadDockZone ID="RadDockZone2" runat="server" Height="165px" Width="300px">
                                        </telerik:RadDockZone>
                                    </td>
                                    <td class="style6">
                                        <telerik:RadDockZone ID="RadDockZone3" runat="server" Height="165px" Width="300px">
                                        </telerik:RadDockZone>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="style3">
                                        <telerik:RadDockZone ID="RadDockZone4" runat="server" Height="165px" Width="300px">
                                        </telerik:RadDockZone>
                                    </td>
                                    <td class="style3">
                                        <telerik:RadDockZone ID="RadDockZone5" runat="server" Height="165px" Width="300px">
                                        </telerik:RadDockZone>
                                    </td>
                                    <td class="style3">
                                        <telerik:RadDockZone ID="RadDockZone6" runat="server" Height="165px" Width="300px">
                                        </telerik:RadDockZone>
                                    </td>
                                </tr>
                            </table>
                        </div>
                           
                    </div>
                </telerik:RadDockLayout>
                <asp:HiddenField runat="server" ID="closedDockZoneId" />
                <%--stores the id of the RadDockZone, which holds the closed RadDock--%>
            </ContentTemplate>
        </asp:UpdatePanel>
      
        <%--Here goes the javascript for the popup--%>
        <script language="javascript" type="text/javascript">
            var popup = 0;
            $("#modalRightCenterContent").dialog({
                minHeight: 48,
                minWidth: 350,
                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');
                $("#chkAlrmSumry").removeAttr('checked');
                $("#chkActCals").removeAttr('checked');
                $("#chkPndCals").removeAttr('checked');
                $("#chkCalActConsole").removeAttr('checked');
                $("#chkDisptchr").removeAttr('checked');
                $("#chkCalActEndpnt").removeAttr('checked');
            });
            $("#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>

    Dashboard.aspx.cs
    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};
        static RadDock[] zone1 = new RadDock[5];
        static RadDock[] zone2 = new RadDock[5];
        static RadDock[] zone3 = new RadDock[5];
        static RadDock[] zone4 = new RadDock[5];
        static RadDock[] zone5 = new RadDock[5];
        static RadDock[] zone6 = new RadDock[5];
      
        string result_dock = null;
        bool loadPageFlag = false;
      
        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;
            }
        }
      
        protected override void OnInit(EventArgs e)
        {
            if (Session["DockFlags"] != null)
                Dock_flag = (bool[])Session["DockFlags"];
            for (int i = 0; i < CurrentDockStates.Count; i++)
            {
                if (CurrentDockStates[i].Closed == true)
                {
                    RadDock dock = new RadDock();
                    dock.Closed = true;
                    dock.Visible = false;
                    //RadDockLayout1.Controls.Remove(dock);
                    CreateSaveStateTrigger(dock);
                }
      
                else  
                {
                    RadDock dock = CreateRadDockFromState(CurrentDockStates[i]);
                    RadDockLayout1.Controls.Add(dock);
                     CreateSaveStateTrigger(dock);
                }
            }
      
           
            if (!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)
                        {
                            loadPageFlag = true;
                            RadDock dock = CreateRadDock(i);
                            // RadDock dock = new RadDock();
                            AddToEmptyRadDock(dock);                       
                            CreateSaveStateTrigger(dock);
                            Dock_flag[i - 1] = true;
                            Session["DockFlags"] = Dock_flag;      
                             
                              
                        }
                    }
                }
            }
        }
      
        public 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 (RadDockZone3.Docks.Count == 0)
            {
                RadDockZone3.Controls.Add(dock);
            }
      
            else 
            if (RadDockZone4.Docks.Count == 0)
            {
                RadDockZone4.Controls.Add(dock);
            }
      
            else 
            if (RadDockZone5.Docks.Count == 0)
            {
                RadDockZone5.Controls.Add(dock);
            }
      
            else
                  
            if (RadDockZone6.Docks.Count == 0)
            {
                RadDockZone6.Controls.Add(dock);
            }
        }
      
        private RadDock CreateRadDockFromState(DockState state)
        {       
      
                RadDock dock = new RadDock();
                dock.DockMode = DockMode.Default;
                dock.EnableAnimation = true;
                dock.EnableRoundedCorners = true;
                dock.EnableTheming = true;
                dock.Height = Unit.Pixel(165);
                dock.Width = Unit.Pixel(300);
                dock.ID = string.Format("{0}", state.UniqueName);
                dock.ApplyState(state);
                dock.Resizable = false;
                dock.TitlebarContainer.HorizontalAlign = HorizontalAlign.Left;
                DockCloseCommand closeCommand = new DockCloseCommand();
                closeCommand.AutoPostBack = true;
                DockExpandCollapseCommand expandCommand = new DockExpandCollapseCommand();
                expandCommand.AutoPostBack = false;
                DockToggleCommand maximizeCommand = new DockToggleCommand();
                maximizeCommand.Text = "Maximize";
                maximizeCommand.CssClass = "max";
                maximizeCommand.AlternateCssClass = "min";
                maximizeCommand.AlternateText = "Restore";        
                maximizeCommand.OnClientCommand = "Dock_OnMaximizeCommand";
                //assign client-side event handler
                dock.OnClientInitialize = "Dock_OnClientInitialize";
                dock.OnClientCommand = "ClientCommand";
                dock.ContentContainer.Style.Add(HtmlTextWriterStyle.OverflowX, "hidden");
                 
                switch (state.Title.ToString())
                {
                    case "Alarm Summary":
      
                        Control widget = LoadControl("Controls/AlarmSummaryCtrl.ascx");
                        dock.Command += new DockCommandEventHandler(this.Dock1_Command);
                        dock.Commands.Add(closeCommand);
                        dock.Commands.Add(maximizeCommand);
                        dock.Commands.Add(expandCommand);
                        chkAlrmSumry.Enabled = false;
                        dock.ContentContainer.Controls.Add(widget);
                        break;
      
                    case "Active Calls":
      
                        widget = LoadControl("Controls/ActiveCallsCtrl.ascx");
                        dock.Command += new DockCommandEventHandler(this.Dock2_Command);
                        dock.Commands.Add(closeCommand);
                        dock.Commands.Add(maximizeCommand);
                        dock.Commands.Add(expandCommand);
                        chkActCals.Enabled = false;
                        dock.ContentContainer.Controls.Add(widget);
                        break;
      
                    case "Pending Calls":
      
                        widget = LoadControl("Controls/PendingCallsCtrl.ascx");
                        dock.Command += new DockCommandEventHandler(this.Dock3_Command);
                        dock.Commands.Add(closeCommand);
                        dock.Commands.Add(maximizeCommand);
                        dock.Commands.Add(expandCommand);
                        chkPndCals.Enabled = false;
                        dock.ContentContainer.Controls.Add(widget);
                        break;
      
                    case "Call Activity for Active Consoles":
      
                        widget = LoadControl("Controls/CallActivityForConoleCtrl.ascx");
                        dock.Command += new DockCommandEventHandler(this.Dock4_Command);
                        dock.Commands.Add(closeCommand);
                        dock.Commands.Add(maximizeCommand);
                        dock.Commands.Add(expandCommand);
                        chkCalActConsole.Enabled = false;
                        dock.ContentContainer.Controls.Add(widget);
                        break;
      
                    case "Call Activity for Active Dispatchers":
      
                        widget = LoadControl("Controls/CallActivityForDispatchrCtrl.ascx");
                        dock.Command += new DockCommandEventHandler(this.Dock5_Command);
                        dock.Commands.Add(closeCommand);
                        dock.Commands.Add(maximizeCommand);
                        dock.Commands.Add(expandCommand);
                        chkDisptchr.Enabled = false;
                        dock.ContentContainer.Controls.Add(widget);
                        break;
      
                    case "Call Activity for Active Endpoints":
      
                        widget = LoadControl("Controls/CallActivityForEndPntCtrl.ascx");
                        dock.Command += new DockCommandEventHandler(this.Dock6_Command);
                        dock.Commands.Add(closeCommand);
                        dock.Commands.Add(maximizeCommand);
                        dock.Commands.Add(expandCommand);
                        chkCalActEndpnt.Enabled = false;
                        dock.ContentContainer.Controls.Add(widget);
                        break;
                }
              
            return dock;
        }
      
        private RadDock CreateRadDock(int i)
        {
            RadDock dock = new RadDock();
            dock.DockMode = DockMode.Default;
            dock.EnableAnimation = true;
            dock.EnableRoundedCorners = true;
            dock.EnableTheming = true;
            dock.Resizable = false;
            dock.TitlebarContainer.HorizontalAlign = HorizontalAlign.Left;
            dock.UniqueName = Guid.NewGuid().ToString();
            dock.ID = string.Format("RadDock{0}", dock.UniqueName);
            dock.ContentContainer.Style.Add(HtmlTextWriterStyle.OverflowX, "hidden");
            //dock.Title = "Dock" + i.ToString();
              
            switch (i)
            {
                case 1:
                    dock.Title = "Alarm Summary";
                    break;
                case 2:
                    dock.Title = "Active Calls";
                    break;
                case 3:
                    dock.Title = "Pending Calls";
                    break;
                case 4:
                    dock.Title = "Call Activity for Active Consoles";
                    break;
                case 5:
                    dock.Title = "Call Activity for Active Dispatchers";
                    break;
                case 6:
                    dock.Title = "Call Activity for Active Endpoints";
                    break;
            }
      
            dock.Height = Unit.Pixel(165);
            dock.Width = Unit.Pixel(300);        
            //assign client-side event handler
            dock.OnClientInitialize = "Dock_OnClientInitialize";
            DockCloseCommand closeCommand = new DockCloseCommand();
            closeCommand.AutoPostBack = true;
            DockToggleCommand maximizeCommand = new DockToggleCommand();
            maximizeCommand.Text = "Maximize";
            maximizeCommand.CssClass = "max";
            maximizeCommand.OnClientCommand = "Dock_OnMaximizeCommand";
            maximizeCommand.AlternateText = "Restore";        
            DockExpandCollapseCommand expandCommand = new DockExpandCollapseCommand();
            dock.OnClientCommand = "ClientCommand";        
      
      
            switch (dock.Title.ToString())
            {
                case "Alarm Summary":
      
                    Control widget = LoadControl("~/DashBoard/Controls/AlarmSummaryCtrl.ascx");
                    dock.Command += new DockCommandEventHandler(this.Dock1_Command);
                    dock.Commands.Add(closeCommand);
                    dock.Commands.Add(maximizeCommand);
                    dock.ContentContainer.Controls.Add(widget);
                     
                    break;
      
                case "Active Calls":
      
                    widget = LoadControl("~/DashBoard/Controls/ActiveCallsCtrl.ascx");
                    dock.Command += new DockCommandEventHandler(this.Dock2_Command);
                    dock.Commands.Add(closeCommand);
                    dock.Commands.Add(maximizeCommand);
                    dock.ContentContainer.Controls.Add(widget);
                    break;
      
                case "Pending Calls":
      
                    widget = LoadControl("~/DashBoard/Controls/PendingCallsCtrl.ascx");
                    dock.Command += new DockCommandEventHandler(this.Dock3_Command);
                    dock.Commands.Add(closeCommand);
                    dock.Commands.Add(maximizeCommand);
                    dock.ContentContainer.Controls.Add(widget);
                    break;
      
                case "Call Activity for Active Consoles":
      
                    widget = LoadControl("~/DashBoard/Controls/CallActivityForConoleCtrl.ascx");
                    dock.Command += new DockCommandEventHandler(this.Dock4_Command);
                    dock.Commands.Add(closeCommand);
                    dock.Commands.Add(maximizeCommand);
                    dock.ContentContainer.Controls.Add(widget);
                    break;
      
                case "Call Activity for Active Dispatchers":
      
                    widget = LoadControl("~/DashBoard/Controls/CallActivityForDispatchrCtrl.ascx");
                    dock.Command += new DockCommandEventHandler(this.Dock5_Command);
                    dock.Commands.Add(closeCommand);
                    dock.Commands.Add(maximizeCommand);
                    dock.ContentContainer.Controls.Add(widget);
                    break;
      
                case "Call Activity for Active Endpoints":
      
                    widget = LoadControl("~/DashBoard/Controls/CallActivityForEndPntCtrl.ascx");
                    dock.Command += new DockCommandEventHandler(this.Dock6_Command);
                    dock.Commands.Add(closeCommand);
                    dock.Commands.Add(maximizeCommand);
                    dock.ContentContainer.Controls.Add(widget);                
                    break;
            }
                   
            return dock;
        }
      
        private void CreateSaveStateTrigger(RadDock dock)
        {
            // Ensure that the RadDock control will initiate postback when its position changes on the client or any of the commands is clicked.  
            // Using the trigger we will "ajaxify" that postback.   
            dock.AutoPostBack = false;
            dock.CommandsAutoPostBack = false;
        }
      
        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;
                }      
             
        }
      
        protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)
        {
            CurrentDockStates = new List<DockState>();
      
            foreach (DockState ds in RadDockLayout1.GetRegisteredDocksState())
            {
                CurrentDockStates.Add(ds);            
            }
      
            Session["DockFlags"] = Dock_flag;
      
            if (loadPageFlag)
            {
                Page.ClientScript.RegisterStartupScript(typeof(Page), "reloadPage", "<script type='text/javascript'>window.location.href = 'DashBoard.aspx';</script>");
                loadPageFlag = false;
            }
        }   
      
        protected void Dock1_Command(object sender, DockCommandEventArgs e)
        {
            if (e.Command.Name.Equals("Close"))
            {
                Dock_flag[0] = false;
                RadDock rad = (RadDock)sender;
                rad.Undock();
                rad.Dispose();
                Refresh();
                chkAlrmSumry.Enabled = true;
                  
            }
        }
         
        protected void Dock2_Command(object sender, DockCommandEventArgs e)
        {
            if (e.Command.Name.Equals("Close"))
            {
                Dock_flag[1] = false;
                RadDock rad = (RadDock)sender;
                rad.Undock();
                rad.Dispose();
                Refresh();
                chkActCals.Enabled = true;
            }
        }
      
        protected void Dock3_Command(object sender, DockCommandEventArgs e)
        {
            if (e.Command.Name.Equals("Close"))
            {
                Dock_flag[2] = false;
                RadDock rad = (RadDock)sender;
                rad.Undock();
                rad.Dispose();
                Refresh();
                chkPndCals.Enabled = true;
            }
        }
      
        protected void Dock4_Command(object sender, DockCommandEventArgs e)
        {
            if (e.Command.Name.Equals("Close"))
            {
                Dock_flag[3] = false;
                RadDock rad = (RadDock)sender;
                rad.Undock();
                rad.Dispose();
                Refresh();
                chkCalActConsole.Enabled = true;
            }
        }
      
        protected void Dock5_Command(object sender, DockCommandEventArgs e)
        {
            if (e.Command.Name.Equals("Close"))
            {
                Dock_flag[4] = false;
                RadDock rad = (RadDock)sender;
                rad.Undock();
                rad.Dispose();
                Refresh();
                chkDisptchr.Enabled = true;
            }
        }
      
        protected void Dock6_Command(object sender, DockCommandEventArgs e)
        {
            if (e.Command.Name.Equals("Close"))
            {
                Dock_flag[5] = false;
                RadDock rad = (RadDock)sender;
                rad.Undock();
                rad.Dispose();
                Refresh();
                chkCalActEndpnt.Enabled = true;
            }
        }
      
        protected void moveToDock(RadDockZone fromDock, RadDockZone toDock)
        {
            for (int i = fromDock.Docks.Count - 1; i >= 0; i--)
            {
                fromDock.Docks[i].DockZoneID = toDock.ID;
            }
        }
      
        protected void Refresh()
        {
            // int closedDockZoneIndex = Int32.Parse(closedDockZoneId.Value.Substring(11, 1));  
            for (int i = 1; i < RadDockLayout1.RegisteredZones.Count; i++)
            {
                for (int j = 0; j < i; j++)
                {
                    if (RadDockLayout1.RegisteredZones[j].Docks.Count == 0)
                    {
                        moveToDock(RadDockLayout1.RegisteredZones[i], RadDockLayout1.RegisteredZones[j]);
                        break;
                    }
                }
            }
        }    
    }
     please do the need full as early as possible
  2. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 15 Sep 2011 Link to this post

    Hi Ram,

    You can find the solution of your problem in the support ticket, containing your project. Please refer to it in order to resolve the issue at hand.

    I would recommend sending a separate ticket for every problem, when using our support system in the future. Doing so will make our communication easier to follow and we will be able to provide solutions to the reported issues much faster. My suggestion is to continue our discussion in the according support ticket.

    Kind regards,
    Slav
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jason
    Jason avatar
    22 posts
    Member since:
    Sep 2007

    Posted 10 Jan 2012 Link to this post

    I am having a similar issue when using a RadGrid in dynamically created RadDocks. Can you provide a description of the solution?
  5. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 13 Jan 2012 Link to this post

    Hello Jason,

    Below you can find the information that was provided for the particular issue:

    The problem is a ViewState related one. It is caused by the following two things:
    1. The dynamically created RadDock's are not added to the same control. Once they are added to the RadDockZone's and other times to RadDockLayout. This causes the incorrect ViewState to be loaded for some of the docks which is causing the problem.
    2. The closed docks are disposed and removed from the page. This again changes the Controls tree of the Page, which is essential when loading and saving the ViewState.

    You have the following options in resolving the issue on your side:

    I hope this will help you resolve your issue. Please let us know if you need further assistance.

    Kind regards,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  6. Jason
    Jason avatar
    22 posts
    Member since:
    Sep 2007

    Posted 13 Jan 2012 Link to this post

    The second option worked great. Thanks!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017