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

TabStrip Visibility issues

1 Answer 47 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Yossi Shmueli
Top achievements
Rank 1
Yossi Shmueli asked on 02 Dec 2009, 01:05 PM
Hi

I'm trying to make a tab with MultiPage control invisible in runtime.
I wrote the following code:

<telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="0">  
    <Tabs> 
        <telerik:RadTab Text="First Tab" Value="First"/>  
        <telerik:RadTab Text="Second Tab" Value="Second"/>  
        <telerik:RadTab Text="Third Tab" Value="Third"/>  
    </Tabs> 
</telerik:RadTabStrip> 
<telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">  
    <telerik:RadPageView ID="First" runat="server">  
        <asp:Label ID="Label1" runat="server" Text="First"/>  
    </telerik:RadPageView> 
    <telerik:RadPageView ID="Second" runat="server">  
        <asp:Label ID="Label2" runat="server" Text="Second"/>  
    </telerik:RadPageView> 
    <telerik:RadPageView ID="Third" runat="server">  
        <asp:Label ID="Label3" runat="server" Text="Third"/>  
    </telerik:RadPageView> 
</telerik:RadMultiPage> 
 

I'm using this code in the page load to hide the second tab:
var tab=RadTabStrip1.Tabs.FindTabByValue("Second");  
tab.Visible = false

When I open the page and switch to the third tab I see the content of the second tab.
I also tried setting the RadPageView as invisible , but then the third tab shows an empty page.

Any ideas?

1 Answer, 1 is accepted

Sort by
0
Accepted
Schlurk
Top achievements
Rank 2
answered on 02 Dec 2009, 08:48 PM
I used the following declaration and javascript and it worked fine for me. When I open the page the second tab is hidden and the first and third tabs show the first and third page content.

<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
    <telerik:RadCodeBlock ID="myCodeBlock" runat="server"
            function myLoad(sender, args) { 
                var tabStrip = $find("<%= RadTabStrip1.ClientID %>"); 
                var tab = tabStrip.findTabByValue("Second"); 
                tab.set_visible(false); 
            } 
        </script> 
    </telerik:RadCodeBlock> 
</head> 
<body> 
    <form id="form1" runat="server"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="0" OnClientLoad="myLoad">   
            <Tabs>  
                <telerik:RadTab Text="First Tab" Value="First"/>   
                <telerik:RadTab Text="Second Tab" Value="Second"/>   
                <telerik:RadTab Text="Third Tab" Value="Third"/>   
            </Tabs>  
        </telerik:RadTabStrip>  
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">   
            <telerik:RadPageView ID="First" runat="server">   
                <asp:Label ID="Label1" runat="server" Text="First"/>   
            </telerik:RadPageView>  
            <telerik:RadPageView ID="Second" runat="server">   
                <asp:Label ID="Label2" runat="server" Text="Second"/>   
            </telerik:RadPageView>  
            <telerik:RadPageView ID="Third" runat="server">   
                <asp:Label ID="Label3" runat="server" Text="Third"/>   
            </telerik:RadPageView>  
        </telerik:RadMultiPage>  
    </form> 
</body> 
</html> 

As you can see I used your setup for the RadTabStrip/Multipage (just copied and pasted).
Tags
TabStrip
Asked by
Yossi Shmueli
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Share this question
or