Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

Splitter / Client-side API

Click on the links below the splitter and see the result. Check the source code to see how the actions are implemented. See also the Client Side Events example.


  • Client-Side API

    SlidingZone provides a flexible client-side API that allows you to easily change the configuration in the browser.

    1. Getting the RadSlidingZone client-side object:

      	var slidingZone = $find("<%= RadSlidingZone1.ClientID %>");
      

    2. Once you get the client-side object of RadSlidingZone, you can use the getPaneById method to get the instance of a particular sliding pane. Example:

      	var slidingZone = $find("<%= RadSlidingZone1.ClientID %>");
      	var pane = slidingZone.getPaneById("RadPane1");
      
      You can also get the collection of all panes in the slidingZone using the getPanes method:
      	var slidingZone = $find("<%= RadSlidingZone1.ClientID %>");
      	var panes = slidingZone.getPanes(); // get the panes collection
      
      	// loop the the collection
      	for (var i=0; i < panes.length; i ++)
      	{
      		var paneObj = panes[i]; // get instance of the RadPane 
      	}
      

    3. Using the client-side API you can dock/undock, expand/collapse, show/hide, resize sliding panes. Examples:

      	var slidingZone = $find("<%= RadSlidingZone1.ClientID %>");
      	slidingZone.collapsePane(paneID); // collapse the pane
      	slidingZone.expandPane(paneID); // expand the pane
      
      	slidingZone.dockPane(paneID); // dock the pane
      	slidingZone.undockPane(paneID); // undock the pane
      
      	slidingZone.hidePaneTab(paneID); // hide the pane tab from the sliding zone
      	slidingZone.showPaneTab(paneID); // show the pane tab from the sliding zone
      
      	var pane = slidingZone.getPaneById(paneId);
      	pane.set_width(100); // set the pane width to 100px
      	var paneWidth = pane.get_width(); // get the current width of the pane
      	pane.setContent('this is the new content of the pane'); // change the pane content
      

    For more detailed preview of the client-side API please refer to the documentation.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

    <%@ Page Language="c#" CodeFile="DefaultCS.aspx.cs" AutoEventWireup="false" Inherits="Telerik.Web.Examples.Splitter.SP_ClientSideApi.DefaultCS" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <qsf:HeadTag ID="Headtag1" runat="server"></qsf:HeadTag>
    </head>
    <body class="BODY">
        <form id="Form1" method="post" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="c#"></qsf:Header>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <div class="bigModule" style="margin-bottom: 40px">
            <div class="bigModuleBottom">
                Click on the links below the splitter and see the result. Check the source code
                to see how the actions are implemented. See also the <strong>Client Side Events</strong>
                example.<br />
            </div>
        </div>
        <telerik:RadSplitter ID="RadSplitter1" runat="server" Height="400" Width="600" VisibleDuringInit="false">
            <telerik:RadPane ID="LeftPane" runat="server" Width="22" Scrolling="None">
                <telerik:RadSlidingZone ID="SlidingZone1" runat="server" Width="22" ClickToOpen="true">
                    <telerik:RadSlidingPane ID="Pane1" runat="server" Title="Pane1" Width="150">
                        1
                    </telerik:RadSlidingPane>
                    <telerik:RadSlidingPane ID="Pane2" runat="server" Title="Pane2" Width="150">
                        2
                    </telerik:RadSlidingPane>
                    <telerik:RadSlidingPane ID="Pane3" runat="server" Title="Pane3" Width="150">
                        3
                    </telerik:RadSlidingPane>
                </telerik:RadSlidingZone>
            </telerik:RadPane>
            <telerik:RadSplitBar ID="RadSplitbar1" runat="server" CollapseMode="Forward" />
            <telerik:RadPane ID="Middle" runat="server" />
            <telerik:RadPane ID="EndPane" runat="server" Width="300">
                <table cellpadding="5">
                    <tr>
                        <td valign="top">
                            <a href="javascript:ToggleExpandPane('Pane1')">Toggle Expand/Collapse on 'Pane 1'</a>
                        </td>
                        <td valign="top">
                            <a href="javascript:ToggleDockPane('Pane1')">Toggle Dock/Undock on 'Pane 1'</a>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <a href="javascript:ToggleEnableResize('Pane1')">Toggle <strong>EnableResize</strong>
                                of the 'Pane 1'</a>
                        </td>
                        <td valign="top">
                            <a href="javascript:ToggleEnableDock('Pane1')">Toggle <strong>EnableDock</strong> of
                                the 'Pane 1'</a>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <a href="javascript:TogglePaneTabVisibility('Pane2')">Toggle Show/Hide on 'Pane 2' tab</a>
                        </td>
                        <td valign="top">
                            <a href="javascript:ChangePaneContent('Pane1')">Change content on 'Pane 1'</a>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <a href="javascript:ChangePaneWidth('Pane1')">Toggle 'Pane 1' width 200 / 100 px</a>
                        </td>
                        <td valign="top">
                            <a href="javascript:ToggleClickToOpen()">Toggle "ClickToOpen" property of the Sliding
                                Zone</a>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <a href="javascript:GetZoneState()">Get Sliding Zone state</a>
                        </td>
                        <td valign="top">
                            <a href="javascript:ToggleDockOnOpen('Pane1')">Toggle "DockOnOpen" property of 'Pane
                                1'</a>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <a href="javascript:GetPaneState('Pane1')">Get 'Pane 1' state</a>
                        </td>
                    </tr>
                </table>
            </telerik:RadPane>
        </telerik:RadSplitter>
        <br />

        <script type="text/javascript">
                    
                    /***********************************************
                                Sliding Zone examples
                    ***********************************************/
                    function GetZoneState ()
                    {
                        var slidingZone = $find("SlidingZone1");
                        var zoneState = slidingZone.get_clientState();
                        alert(zoneState);
                    }
                    
                    /***********************************************
                                Pane examples
                    ***********************************************/
                
                    function ToggleEnableResize(paneID)
                    {
                        var slidingZone = $find("SlidingZone1");
                        var pane = slidingZone.getPaneById(paneID);

                        if (!pane) return;
                        pane.set_enableResize(!pane.get_enableResize());
                        slidingZone.collapsePane(pane.get_id());
                        slidingZone.expandPane(pane.get_id());
                        
                    }
                    
                    function ToggleEnableDock(paneID)
                    {
                        var slidingZone = $find("SlidingZone1");
                        var pane = slidingZone.getPaneById(paneID);

                        if (!pane) return;
                        
                        pane.set_enableDock(!pane.get_enableDock());
                        slidingZone.undockPane(pane.get_id());
                        slidingZone.collapsePane(pane.get_id());
                        slidingZone.expandPane(pane.get_id());
                        
                    }
                    
                    function GetPaneState(paneID)
                    {
                        var slidingZone = $find("SlidingZone1");
                        var pane = slidingZone.getPaneById(paneID);

                        if (!pane) return;
                        
                        var paneState = pane.get_clientState();
                        alert(paneState);
                    }
                
                    function ToggleExpandPane(paneID)
                    {
                        var slidingZone = $find("SlidingZone1");
                        var expandedPaneId = slidingZone.get_expandedPaneId();
                        
                        if (expandedPaneId == null || expandedPaneId != paneID)
                        {
                            slidingZone.expandPane(paneID);
                        }
                        else
                        {
                            slidingZone.collapsePane(paneID);
                        }
                    }
                    
                    function ToggleDockPane(paneID)
                    {
                        var slidingZone = $find("SlidingZone1");
                        var dockedPaneId = slidingZone.get_dockedPaneId();
                        
                        if (dockedPaneId == null || dockedPaneId != paneID)
                        {
                         slidingZone.collapsePane(paneID);
                            slidingZone.dockPane(paneID);
                        }
                        else
                        {
                            slidingZone.undockPane(paneID);
                        }
                    }
                    
                    function TogglePaneTabVisibility(paneID)
                    {
                        var slidingZone = $find("SlidingZone1");
                        var pane = slidingZone.getPaneById(paneID);
                        if (pane.isTabDisplayed())
                        {
                            pane.hideTab();
                        }
                        else
                        {
                            pane.showTab();
                        }
                    }
                    
                    function ChangePaneContent (paneID)
                    {
                        var slidingZone = $find("SlidingZone1");
                        var pane = slidingZone.getPaneById(paneID);
                        if (!pane) return;
                        
                        pane.setContent('This is the NEW pane content ...');
                        slidingZone.collapsePane(pane.get_id());
                        slidingZone.expandPane(pane.get_id());
                    }
                    
                    function ChangePaneWidth (paneID)
                    {
                        var slidingZone = $find("SlidingZone1");
                        var pane = slidingZone.getPaneById(paneID);
                        if (!pane) return;
                        
                        var newWidth = (pane.get_width() == 200) ? 100 : 200 ;
                        
                        pane.set_width(newWidth); // set the width
                        slidingZone.collapsePane(pane.get_id());
                        slidingZone.expandPane(pane.get_id());
                    }
                    
                    function ToggleClickToOpen ()
                    {
                        var slidingZone = $find("SlidingZone1");
                        slidingZone.set_clickToOpen(!slidingZone.get_clickToOpen());
                        alert("'ClickToOpen' property set to [" + slidingZone.get_clickToOpen() + "]");
                    }
                    
                        function ToggleDockOnOpen (paneID)
                    {
                        var slidingZone = $find("SlidingZone1");
                        var pane = slidingZone.getPaneById(paneID);
                        if (!pane) return;
                        pane.set_dockOnOpen(!pane.get_dockOnOpen());
                        alert("'DockOnOpen' property set to [" + pane.get_dockOnOpen() + "]");
                    }
                    
        </script>

        <qsf:Footer runat="server" ID="Footer1"></qsf:Footer>
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451