Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > RibbonBar > Possible bug: Setting SelectedTabIndex with invisible tabs

Not answered Possible bug: Setting SelectedTabIndex with invisible tabs

Feed from this thread
  • Ioish avatar

    Posted on Mar 13, 2012 (permalink)

    Hi, I seem to have bumped into a bug with the RibbonBar control.

    When setting SelectedTabIndex having 4 tabs, all of the visible, everything works normally:

    Ribbon.SelectedTabIndex = Ribbon.Tabs.IndexOf(Ribbon 
    .FindTabByValue("tabName"))

    However when I make some tabs invisible (index 0 and 2 in my case), it completely messes up the SelectedTabIndex property:

    It defaults to 1, and it seems to be impossible to change. Even having this value it is still inconsistent, showing either tab 1 or 3:

    When tab 1 is selected client side and a postback occurs, the selected tab will switch to 3 on the client side after postback and vice versa. 

    To make the tabs invisible I use: 
    Menu.Tabs(0).Visible = False
    Menu.Tabs(2).Visible  = False

    Am I making a mistake or is this really a bug? 

    Update:  It works when programatically removing the tabs before setting the index. This works for me as I won't need the invisible tabs on the client side or serverside anyway, but I imagine this might cause problems for other people.

    Reply

  • Bozhidar Bozhidar admin's avatar

    Posted on Mar 16, 2012 (permalink)

    Hi Ioish,

    Unfortunately I wasn't able to reproduce this issue. Perhaps I am missing something. Could you please specify the exact sequence of actions that leads to the problem. A video capture of it would also be very helpful.
     
    All the best,
    Bozhidar
    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.

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Ned avatar

    Posted on Apr 11, 2012 (permalink)

    I'd like to confirm this bug as stated by the original poster. When setting tab visibility, at least programmatically via C# code behind, the current RadRibbonBar selected tab index is lost (actually rewritten).

    Example:

    There are 7 visible tabs (indexes 0-6) and  fifth tab was selected as active (RadRibbonBar.SelectedTabIndex = 4). Make second tab invisible now (index 1) and RadRibbonBar.SelectedTabIndex now equals 5 which points to a different tab being selected than one desired.

    It seems RadRibbonBar.SelectedTabIndex property is maintained only for visible members of collection although oddly the tab count does not increase/decrease.

    I'm somewhat at odds with the original post as making the tabs invisible before setting the index screws things up anyway (using said C# code behind approach).
    -----------------------------------------------------------------------
    Code sample:

            private void DirectoryTabSetUp()
            {
                if (ClientsModules.HasFlag(ClientsModuleTypes.DirectoryAccess))
                {
                    if (CurrentUserSettings.ContainsKey(UserSettingTypes.DirectoryAccessOnly))
                    {
                        ribTabDrawings.Visible = true;//albeit this will be simplified version of Drawings
                        ribTabFiles.Visible = false;
                        ribTabAdmin.Visible = false;
                        rbTabReporting.Visible = false;
                        ribTabExplore.Visible = false;
                        RadRibbonBar.SelectedTabIndex = 4;
                        SimpleDrawingTabSetUp();
                    }
                }
                else
                {
                    ribTabDirectory.Visible = false;                
                }

            }

    ------------------------------------------------------------------------

    For the above sample, all that matters is that ribTabDrawings has a tab index of 0 in collection and ribTabDirectory has tab index of 4. When one sets RadRibbonBar.SelectedTabIndex = 4 in the code above, SelectedTabIndex is coalesced to 0 making ribTabDrawings tab active. If I now wanted to make ribTabDirectory selected I'd need to code RadRibbonBar.SelectedTabIndex = 1 (effectively saying, hey there are now only 2 visible tabs, make the second one active). But that's just visual order (from left to right to boot).


    Thanks,
    Ned

    Reply

  • Bozhidar Bozhidar admin's avatar

    Posted on Apr 13, 2012 (permalink)

    Hi Ned,

    Thank you for clarifying.

    I confirm that this is a bug in the RibbonBar and I have logged it for fixing in our system.
     
    All the best,
    Bozhidar
    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.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > RibbonBar > Possible bug: Setting SelectedTabIndex with invisible tabs
Related resources for "Possible bug: Setting SelectedTabIndex with invisible tabs"

ASP.NET RibbonBar Features  |  Documentation  |  Demos  |  Step-by-step Tutorial  ]