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

Deleting tab doesnt delete from index

2 Answers 41 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Nik
Top achievements
Rank 1
Nik asked on 05 Oct 2011, 05:01 PM
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 Answers, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 10 Oct 2011, 11:26 AM
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
0
Nik
Top achievements
Rank 1
answered on 10 Oct 2011, 07:34 PM
Ahhh, I didn't see the PageViewID attribute. That did the trick, thank you!
Tags
TabStrip
Asked by
Nik
Top achievements
Rank 1
Answers by
Kate
Telerik team
Nik
Top achievements
Rank 1
Share this question
or