This is a migrated thread and some comments may be shown as answers.

Hide SlidingZone Tab on load

2 Answers 65 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Adam Heeg
Top achievements
Rank 1
Adam Heeg asked on 28 Jul 2010, 04:18 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Dobromir
Telerik team
answered on 02 Aug 2010, 01:18 PM
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
0
Adam Heeg
Top achievements
Rank 1
answered on 10 Aug 2010, 02:42 PM
Thank you, that did fix the javascript error.
Tags
Splitter
Asked by
Adam Heeg
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Adam Heeg
Top achievements
Rank 1
Share this question
or