How to obtain a unique tab index in multi-level tab hierarchy (e.g. normal SelectedIndex, SelectedTab, IndexOf, etc. return only an index for that tab level not a unique tab index for all levels)?

2 posts, 0 answers
  1. jgill
    jgill avatar
    116 posts
    Member since:
    Jul 2005

    Posted 25 Sep 2009 Link to this post

    I have a scenario where I have a tabstrip that contains multiple levels of tab hierarchy and I want to find a unique index across all tabs (not just the tabs on Level 0, Level 1, etc.).  Normal SelectedIndex, SelectedTab, IndexOf, etc. on the tabs returns only an index for that tab level not a unique tab index for all levels.

    Do tabs have a unique index that can be accessed that is a unique tab index across all tabs in the tabstrip collection?  If not, how could I add one (I need it to work like a index, not the value of the tab).

    Example:  Imagine in this scenario that there is 1 tabstip, 2 parent tabs.  One Parent tab has two children and another Parent tab has three children.  I would like the Child3 of Parent2 to have the highest tab index and be able to access that index value.  

    Parent1                        Parent2
    Child1    Child2            Child1    Child2    Child3

    The index of Parent1 = 0 and Parent 2 = 1 when I check through normal Index methods.  The index of Parent1's Child1 is 0 and the indexif Parent2's Child1 is also 0.  I am assuming that parents are created before their children, so in that case is there some kind of wider scope index where the tabs have indexes that do not repeat with the following structure (or could be created).

    Parent1(Index = 0)                                           Parent2 (Index= 3)
    Child1(Index = 1)    Child2 (Index = 2)              Child1(Index = 4)    Child2(Index = 5)    Child3(index = 6)

    Thank you for your help,
  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 25 Sep 2009 Link to this post

    Hi jgill,

    A possible workaround is to get the global index of the tab using the GetAllTabs method:

    IList<RadTab> allTabs = RadTabStrip1.GetAllTabs();
    int index = allTabs.IndexOf(someTab);

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top