Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
207 views
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
Jason
Top achievements
Rank 1
 answered on 13 Jan 2012
3 answers
119 views

Dear Experts,

I am using RadGrid to implement a business application showing some tabular data which should be filtered according to the responsible user(owner).

In order to maximize the user experience I used two additional features 

The problem is that I am not able to apply default filter on initial load with client side binding. I suppose this should be possible by properly initialize the Grid’s server state that reflects on the client as filterExpressions array.

I tried the following approaches but none seems to be the right one:

I am using (DNN - RadAjax Version: 2011.2.712.35

Has anyone experience with this approach?

Any hint will be highly appreciated.

Thank you, 
Kristijan


Andrey
Telerik team
 answered on 13 Jan 2012
2 answers
479 views
Is it possible to have a tooltip close when the user clicks away, so that it behaves more like a combo box? None of the options really support this as they either have to close it manually or risk that it will close when the user's mouse leaves the tooltip.
Yeroon
Top achievements
Rank 2
 answered on 13 Jan 2012
7 answers
514 views
Dear Telerik Team,


Please do me favor one thing.

Now,I'm facing the  following error.

Could not load file or assembly 'Telerik.Web.UI, Version=2011.1.413.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

<add path="ChartImage.axd" verb="*" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Version=2011.1.413.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false"/>

Thanks in advance....
Ch4rl3s
Top achievements
Rank 2
 answered on 13 Jan 2012
1 answer
136 views
Hello,

I have a radgrid which contains 2 templated columns each containing a button and a label. When the buttons are clicked, a modal radWindow is displayed allowing the user to select a value which, once the window is closed, is displayed within the label next to the button that was clicked within the templated column. Importantly the value at this point has not been saved to a database.

When the button in the second templated column is clicked, I need to be able to pass the value in the label from the first templated column to the modal radWindow as this value affects the list of available values which are displayed in that radWindow.

How do I get the value from the label in the first templated column when the button in the second templated column is clicked? I have tried setting a custom attribute (which works fine if the value originates from the database) however if I update the label and try setting the attribute using javascript (below), the value is not retained.

objLookupCellLabel.childNodes[0].setAttribute("clientcode", Code);

Many thanks
Andrey
Telerik team
 answered on 13 Jan 2012
4 answers
300 views
I have grids that are not expanding to fill the complete witdth.  I used the default skin and just made two changes to it in regards to color and call it "MySkin". This is not happening to all my girds, just some of them and I can't seem to find what is causing this.

The grid works fine and the columns line up underneith the headers on localhost, but the servers we deploy to are the problem. The page loads and looks like it will line up underneith the headers for a brief second then shrinks.

Telerik.Web.UI.dll:  2010.1.415.35

<telerik:RadGrid ID="RadGrid1" 
 AllowMultiRowSelection="False"  
 AllowSorting="True"
 AllowNaturalSort="True" 
 AllowPaging="True" 
 AutoGenerateColumns="False" 
 AlternatingItemStyle-HorizontalAlign="Left"
 GroupingEnabled="True" 
 HeaderStyle-HorizontalAlign="Center" 
 Height="475px" 
 ItemStyle-HorizontalAlign="Left"
 OnSortCommand="RadGrid1_SortCommand" 
 OnNeedDataSource="RadGrid1_NeedDataSource"
 OnItemDataBound="RadGrid1_ItemDataBound" 
 PageSize="15" 
 ShowFooter="True" 
 ShowHeader="True" 
 ShowGroupPanel="False" 
 ShowStatusBar="True" 
 SelectedItemStyle-ForeColor="#000000"                         
 EnableEmbeddedSkins="False" 
 Skin="MySkin"                           
 Width="100%"
 runat="server">

 

<MasterTableView AllowMultiColumnSorting="True" DataKeyNames="ID" TableLayout="Fixed" HeaderStyle-Wrap="false" Width="100%">

 

Mike
Top achievements
Rank 1
 answered on 13 Jan 2012
1 answer
92 views
hello,
i am trying to add tooltip text to my hyper links, but when i save my item it saves everything except tooltip text. when i reopen my item i can not see tooltip text on HyperLink Manager tooltip box. am i missing something? how can i add tooltip to my links? is there any other ways?

thanks in advance.
Dobromir
Telerik team
 answered on 13 Jan 2012
1 answer
218 views
error: Unable to cast object of type 'Telerik.Web.UI.RadMultiPage' to type 'System.Web.UI.UserControl'.

When going through a user control for a EditFormUserControl and I wanted to list all the user controls on that page but doing a foreach loop I need a fairly consistent type to iterate through.  So how can I iterate through 'userControl' when it could be a lteral for a label or  a 'RadMultiPage' or a 'UserControl'.  I have tried ...string objectTypeName="RadMultiPage";

 

Type

 

T = Type

 

.GetType(objectTypeName);

 

((

typeof(T)))userControl).Controls

 

 

But I just wanter to be able to have a reursive call listing out all the children be them Usercontrol or Telerik User controls. 
Any Ideas ?
Doug

 

 

 

UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);

foreach

 

(object uc in ((UserControl)userControl).Controls){}

 

Kate
Telerik team
 answered on 13 Jan 2012
2 answers
122 views
I'm using Telerik.Web.UI 2011.2.712.35 and want to use grouping. The group exapand/collapse works properly when UseStaticHeaders is set to False. But when UseStaticHeaders is set to True, expanding or collapsing a group cause a lot of white space between the header and the 1st grid row's data. Grid settings as per code below. See BeforeExpand.png and AfterExpand.png screenshots. Note: After forcing a postback, grid returns to BeforeExpand.png view.

 

<telerik:RadGrid ID="rgPOsNew" runat="server" ShowGroupPanel="True" AutoGenerateColumns="False" AllowPaging="False" AllowSorting="True" Width="98%" EnableTheming="False" GridLines="None"  OnNeedDataSource="rg_NeedDataSource">

 <ClientSettings AllowDragToGroup="True" AllowGroupExpandCollapse="True" AllowColumnsReorder="True">

    <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True">

     </Resizing>

     <Scrolling AllowScroll="True" UseStaticHeaders="False" ScrollHeight="400px" />

 </ClientSettings>

 <HeaderStyle Wrap="True" HorizontalAlign="Center" VerticalAlign="Middle" Height="20px" />

 <GroupPanel>

 </GroupPanel>

 <MasterTableView HorizontalAlign="Center" GroupLoadMode="Client" Width="98%">

     <GroupByExpressions>

         <telerik:GridGroupByExpression>

             <GroupByFields>

                 <telerik:GridGroupByField FieldAlias="JobNumber" FieldName="JobNumber" />

                     </GroupByFields>

                         <SelectFields>

                     <telerik:GridGroupByField FieldAlias="JobNumber" FieldName="JobNumber" />

                     </SelectFields>

             </telerik:GridGroupByExpression>

         </GroupByExpressions>

     <GroupHeaderItemStyle BackColor="LightSteelBlue" />

     <RowIndicatorColumn>

     <HeaderStyle Width="20px" />

     </RowIndicatorColumn>

     <ExpandCollapseColumn Visible="False">

         <HeaderStyle Width="20px" />

     </ExpandCollapseColumn>

     <AlternatingItemStyle BackColor="#E0E0E0" />

     <ItemStyle BackColor="White" />

     <Columns>

 



RRH
Top achievements
Rank 1
 answered on 13 Jan 2012
1 answer
192 views
Hi Admin,

I want to fire RadTreeView to expand and load data, to nodes dynamically and automatically. When I use normal asp.net tree view and its property ''PopulateOnDemand" and set 'OnTreeNodePopulate' to fire a function, it does the pupose.
ASPX:-
<
asp:TreeView Runat="Server" OnTreeNodePopulate="Node_Populate" ID="treeView1"  OnTreeNodeExpanded="Node_Expand">
 
<Nodes>
 
<asp:TreeNode Text="ALL"  PopulateOnDemand= "true" Value="0"  />
 
</Nodes>
 
</asp:TreeView>


CS file:-

public
void Node_Populate(object sender, System.Web.UI.WebControls.TreeNodeEventArgs e)
    {
        if (e.Node.ChildNodes.Count == 0)
        {
            switch (e.Node.Depth)
            {
                case 0:
                    FillTerritories(e.Node);
                    break;
                case 1:
                    FillOrganizations(e.Node);
                    break;
                case 2:
                    FillOffices(e.Node);
                    break;
            }
        }
    }
So when the page loades,TreeView loades with a root node ("ALL") and hence forth, due to 'PopulateOnDemand' property its node gets fired(clicked), calling 'Node_Populate' function to handle the loading of nodes.


Now, THE QUESTION. Same thing I want in telerik. I already tried what documentation is available here and suggestion by experts here.
the is:- telerik property 'OnNodeExpand' fires only when a node is clicked by someone. I want to populate node automatically from root node itself. So please help what to do in this regard.

Here is what I have tried:-
ASPX File
<telerik:RadTreeView Runat="Server" ID="RadTreeView1" Skin="Vista" OnNodeExpand = "Rad_NodeExpand" >
</telerik:RadTreeView>

CS FILE
protected void Rad_NodeExpand(object sender, RadTreeNodeEventArgs e)
    {
        if (e.Node.Nodes.Count == 0)
        {
            switch (e.Node.Level)
            {
                case 0:
                    FillTerritories(e.Node);
                    break;
                case 1:
                    FillOrganizations(e.Node);
                    break;
                case 2:
                    FillOffices(e.Node);
                    break;
            }
        }
    }


     PLEASE DON'T REFER ME ANY DOCUMENT. SEE IF YOU CAN GET MY PROBLEM.

Thanks a lot

 

 

Bozhidar
Telerik team
 answered on 13 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?