ReorderTabsOnSelect has no effect?

4 posts, 0 answers
  1. Jeremy
    Jeremy avatar
    96 posts
    Member since:
    Mar 2010

    Posted 27 Jan 2011 Link to this post

    Hi

    I am adding tabs to a radtabstrip dynamically and the tabs automatically break over multiple rows when they exceed the width of the tabstrip, which is nice. However when I select a tab in the top row it doesn't reorder - which is not so nice. Similar to this question. I have ReorderTabsOnSelect = true, is there something else I have to set?

    Markup:
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server"
         MultiPageID="RadMultiPage1"
         SelectedIndex="0"
         Skin="Vista"
         ReorderTabsOnSelect="true"
         Width="550px">
    </telerik:RadTabStrip>
     
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server"
         SelectedIndex="0"
         BorderStyle="Solid" BorderColor="Gray" BorderWidth="1px"
         OnPageViewCreated="RadMultiPage1_PageViewCreated">
    </telerik:RadMultiPage>


    Source Code:
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            //get details of tabs
            List<DummyObject> lstDummys = GetTabsFromDataBase(Request.QueryString["Tabs"]);
            //loop through and add to page
            foreach (DummyObject obj in lstDummys)
            {
               //add tab
               RadTabStrip1.Tabs.Add(new Telerik.Web.UI.RadTab(obj._displayName));
               //add pageview
               RadPageView pageView = new RadPageView();
               pageView.ID = obj._name;
               RadMultiPage1.PageViews.Add(pageView);
            }
        }
    }
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 Jan 2011 Link to this post

    Hello Jeremy,

    You should set IsBreak property to the tab that will start on a new row and the reorder will work as expected. Here is a sample code.
    C#
    protected void Page_Load(object sender, EventArgs e)
       {
           if (Page.IsPostBack == false)
           {
     
               for (int i = 0; i < 4; i++)
               {
                  RadTabStrip1.Tabs.Add(new Telerik.Web.UI.RadTab(i.ToString()));
                  if (i == 2)
                  {
                      RadTab newtab = RadTabStrip1.Tabs.FindTabByText(i.ToString());
                      newtab.IsBreak = true;
                  }
                   RadPageView pageView = new RadPageView();
                   pageView.ID = i.ToString(); ;
                   RadMultiPage1.PageViews.Add(pageView);
               }
           }
       }


    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jeremy
    Jeremy avatar
    96 posts
    Member since:
    Mar 2010

    Posted 27 Jan 2011 Link to this post

    Thanks Shinu. But I don't know on which tab to put the tab break. The tab widths will be different, as the text of each is loaded dynamically. Putting a tab break after every 4th tab will not account for really wide tabs or really narrow tabs. I guess I could do some crappy character count of tab texts and guess how wide they are going to be displayed, but pretty hacky! Do you know a better way?
  5. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 31 Jan 2011 Link to this post

    Hello Jeremy,

    Unfortunately you couldn't determine the width of the rendered tab on the server-side and set isBreak if it's necessary.
    In your scenario using ReorderTabsOnSelect won't be possible.

    All the best,
    Dimitar Terziev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top