Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / How do you hide a tab in Javascript?

How do you hide a tab in Javascript?

New Discussion
Sean
Sean asked on Jun 10, 2010 1:02 AM

 

I'm trying to hide a tab when the user clicks a menu item from a webexplorerbar. I have this code below , but can't get the selected tab to be set as hidden/visable

function HideTab()

 

    {

        var webTab = $find("<%=WebTab1.ClientID%>");

        var tab = webTab.getTabAt(0);

        tab.set_visible(false);

    }

 

 

Sign In to post a reply

Replies

  • 0
    [Infragistics] Viktor Snezhko
    [Infragistics] Viktor Snezhko answered on Jun 9, 2010 6:24 PM

    Hi Naish,

    The names of get/set properties on client mostly match with corresponding properties on server. Since Visible is property of base WebControl, that is not supported by tab item and the visibility is defined by Hidden.
    If you are not sure exact names of methods or do not want to consult docs, then you may put the "debugger;" line and look at available methods for object which you are interested in. Below I wrote an example for you to hide tabs on client.

    <script type="text/javascript">
    function hideTab(index)
    {
     var webTab = $find('<%=WebTab1.ClientID%>');
     if(!webTab)
      return;
     //debugger;
     if(index == null)
     {
      index = webTab.get_selectedIndex();
      if(index < 0)
      {
       alert('There is no selected tab');
       return;
      }
     }
     var tab = webTab.getTabAt(index);
     if(!tab)
      alert('There is no tab at index:' + index);
     else
      tab.set_hidden(true);
    }
    </script>
      <ig:WebTab ID="WebTab1" runat="server" Height="240px" Width="470px">
       <Tabs>
        <ig:ContentTabItem runat="server" Text="Tab 1">
        </ig:ContentTabItem>
        <ig:ContentTabItem runat="server" Text="Tab 2">
        </ig:ContentTabItem>
        <ig:ContentTabItem runat="server" Text="Tab 3">
        </ig:ContentTabItem>
        <ig:ContentTabItem runat="server" Text="Tab 4">
        </ig:ContentTabItem>
       </Tabs>
      </ig:WebTab>
      <input type="button" value="hide 0" onclick="hideTab(0)" />
      <input type="button" value="hide selected" onclick="hideTab()" />

    • 0
      Sean
      Sean answered on Jun 10, 2010 1:02 AM

      Thanks. Worked.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Sean
Favorites
0
Replies
2
Created On
Jun 10, 2010
Last Post
16 years, 3 months ago

Suggested Discussions

Tags

Created by

Created on

Jun 10, 2010 1:02 AM

Last activity on

Jun 10, 2010 1:02 AM