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

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

1 Answer 119 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 13 May 2008, 02:20 AM
Hi

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

1 Answer, 1 is accepted

Sort by
0
Accepted
Paul
Telerik team
answered on 14 May 2008, 01:30 PM
Hello Mark,

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

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

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


Sincerely yours,
Paul
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TabStrip
Asked by
Mark
Top achievements
Rank 1
Answers by
Paul
Telerik team
Share this question
or