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

ReorderTabsOnSelect has no effect?

3 Answers 80 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 27 Jan 2011, 06:20 AM
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);
        }
    }
}

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Jan 2011, 12:35 PM
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.
0
Jeremy
Top achievements
Rank 1
answered on 28 Jan 2011, 12:43 AM
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?
0
Dimitar Terziev
Telerik team
answered on 31 Jan 2011, 03:46 PM
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.
Tags
TabStrip
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jeremy
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or