TabStrip Visibility issues

2 posts, 1 answers
  1. Yossi Shmueli
    Yossi Shmueli avatar
    2 posts
    Member since:
    Dec 2009

    Posted 02 Dec 2009 Link to this post

    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?
  2. Answer
    Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 02 Dec 2009 Link to this post

    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).
Back to Top