Hide SlidingZone Tab on load

3 posts, 1 answers
  1. Adam Heeg
    Adam Heeg avatar
    19 posts
    Member since:
    Jul 2012

    Posted 28 Jul 2010 Link to this post

    I've been trying to have my sliding zone load with the Tab hidden.  This is proving difficult.  I have tried putting javascript in the page to run when the page is rendered.  That throws an error though, even when I put the script at the end of the page it runs before the controls are rendered on the page and throws a script error.  This also happens when I register client script block at the end of the pageload server side.

    The one thing that come the closest to working is calling the javascript in the OnClientLoad event of the RadSplitter.  However, this throws a javascript error which I will note below.  Everything works, everything, but I cannot have a javascript error on my page for the end user.

    The Error is 'Object doesn't support this property or method.'

    The debugger shows the error at this code in the page:
    getHandler:function(b){var a=this._getEvent(b);if(!a||a.length===0)return null;a=Array.clone(a);return function(c,d){for(var b=0,e=a.length;b<e;b++)a[b](c,d)}}

    the highlighted error is at the end on

    a

     

    [b](c,d)

    Clearly this is not being thrown in the javascript I am using.  Here is the code I am using.

     

    <telerik:RadSplitter 
       ID="RadSplitter2" 
       runat="server" 
       Height="82px" 
       Width="100%"
       Orientation="Horizontal"
       VisibleDuringInit="false" 
       Skin="EPSS" 
       EnableEmbeddedSkins="false" 
       OnClientLoad="javascript:TogglePaneTabVisibility('<%=SlidingPane.ClientID %>')"
    >

    function TogglePaneTabVisibility(panelid)
          {
                var slidingZone = $find("<%=szCR.ClientID %>"); 
                var pane = slidingZone.getPaneById("<%=SlidingPane.ClientID %>"); 
                  
              if (pane.isTabDisplayed())
               {
                    pane.hideTab();
                }
                else
                {
                    pane.showTab();
               }
          }


    Any help is greatly appreciated.

  2. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 02 Aug 2010 Link to this post

    Hi Adam,

    The JavaScript error occurs because of how the OnClientLoad property is set. By design, RadSplitter expects the value of this property to be a string value and to be a name of the JavaScript function. Please find the correct declaration of RadSplitter bellow:
    <telerik:RadSplitter ID="RadSplitter2" runat="server" Height="82px" Width="100%"
        Orientation="Horizontal" VisibleDuringInit="false" Skin="EPSS" EnableEmbeddedSkins="false"
        OnClientLoad="TogglePaneTabVisibility">
        <telerik:RadPane ID="RadPane1" runat="server">
            <telerik:RadSlidingZone ID="szCR" runat="server">
                <telerik:RadSlidingPane ID="SlidingPane" runat="server">
                </telerik:RadSlidingPane>
            </telerik:RadSlidingZone>
        </telerik:RadPane>
    </telerik:RadSplitter>
    <asp:Button ID="Button1" runat="server" Text="Toggle Pane's Tab" OnClientClick="TogglePaneTabVisibility(); return false" />
    <script type="text/javascript">
        function TogglePaneTabVisibility()
        {
            var slidingZone = $find("<%=szCR.ClientID %>");
            var pane = slidingZone.getPaneById("<%=SlidingPane.ClientID %>");
     
            if (pane.isTabDisplayed())
            {
                pane.hideTab();
            }
            else
            {
                pane.showTab();
            }
        }
    </script>
     

    Greetings,
    Dobromir
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adam Heeg
    Adam Heeg avatar
    19 posts
    Member since:
    Jul 2012

    Posted 10 Aug 2010 Link to this post

    Thank you, that did fix the javascript error.
Back to Top