Using Javascript to display a tab after its style was set to 'none'

2 posts, 1 answers
  1. Mark
    Mark avatar
    97 posts
    Member since:
    Nov 2007

    Posted 12 May 2008 Link to this post


    I have a scenario where a tab's style can be set to none in C#. E.g.

        Tab1.Style.Add(HtmlTextWriterStyle.Display, "none");

    This works nicely and as expected. This 'Tab1' has a value of 'tabDocuments'.

    However how do I show this again in Javascript? I tried the following...

    $find(gRadTabStrip1ID).findTabByValue('tabDocuments').get_element().style.display = '';

    ... however I must be using a wrong approach?

    Kind regards

    Mark Eaton
  2. Answer
    Paul avatar
    4281 posts

    Posted 14 May 2008 Link to this post

    Hello Mark,

    Please find below a sample code snippet that shows the needed approach.

    <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager1" runat="server">  
        <script type="text/javascript">          
        function show()  
            var myTabstrip = $find('<%= RadTabStrip1.ClientID %>');  
            myTabstrip.findTabByValue('tabDocuments').get_linkElement().style.display = '';  
        <telerik:RadTabStrip ID="RadTabStrip1" runat="server">  
                <telerik:RadTab runat="server" Text="Root RadTab1">  
                <telerik:RadTab runat="server" Text="Root RadTab2" Value="tabDocuments">  
                <telerik:RadTab runat="server" Text="Root RadTab3">  
        <input id="Button2" type="button" value="show" onclick="show()" /> 

    protected void Page_Load(object sender, EventArgs e)  
        RadTab myTab = (RadTab)RadTabStrip1.FindTabByValue("tabDocuments");  
        myTab.Style.Add(HtmlTextWriterStyle.Display, "none");  

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top