Deleting tab doesnt delete from index

3 posts, 0 answers
  1. Nik
    Nik avatar
    51 posts
    Member since:
    Sep 2009

    Posted 05 Oct 2011 Link to this post

    I have a tabstrip on my page with a handful of tabs...
    <rad:RadTabStrip ID="radDetailsTabs" CssClass="radDetailsTabs" runat="server" MultiPageID="radmultipage"
                        BorderWidth="0" OnClientTabSelected="" Skin="Vista" Style="padding: 0; margin: 0;">
                        <Tabs>
                            <rad:RadTab Text="Details" Selected="true" Width="95px">
                            </rad:RadTab>
                            <rad:RadTab Text="Specifications" Width="95px">
                            </rad:RadTab>
                            <rad:RadTab Text="Reviews" Width="95px">
                            </rad:RadTab>
                            <rad:RadTab Text="How To" Width="95px">
                            </rad:RadTab>
                            <rad:RadTab Text="Custom" Width="95px">
                            </rad:RadTab>
                        </Tabs>
                    </rad:RadTabStrip>

    Then I have some JS that runs on pageload that will remove one of the tabs if its not needed...
    function pageLoad() {      
            if (document.getElementById('ctl00_ContentPlaceHolder1_hidShowHowToTab').value == "0") {
                hideTab("How To");
            }
    }
    function hideTab(strTabName) {
            var tabStrip = $find('ctl00_ContentPlaceHolder1_radDetailsTabs');
            var tab = tabStrip.findTabByText(strTabName);
            if (tab) {
               var parentTab = tab.get_parent();
               tabStrip.trackChanges();
               parentTab.get_tabs().remove(tab);
               tabStrip.commitChanges();
             }
        }

    This worked great, until I added the new Custom tab. Now when I click on Custom tab, it shows the content of the How To tab instead. You can see from the attached that the how to tab is set to display block and the clientstate selected index is set to 3 instead of 4. the custom tab is show correctly as selected, but the content revealed is incorrect. Am I missing something?
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 10 Oct 2011 Link to this post

    Hello Nik,

    Did you try to explicitly assign a page to the desired tab as described in this help article? Thus, you can load the page page that is needed when you click the specified tab and the order of the PageView-s will not get mixed up.

    All the best,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nik
    Nik avatar
    51 posts
    Member since:
    Sep 2009

    Posted 10 Oct 2011 Link to this post

    Ahhh, I didn't see the PageViewID attribute. That did the trick, thank you!
Back to Top