How can I preserve RadTab selectedindex?

2 posts, 0 answers
  1. chris lively
    chris lively avatar
    11 posts
    Member since:
    Sep 2009

    Posted 17 Jun 2010 Link to this post

    I have a RadTabStrip with 3 tabs

    There is one RadMultiPage with 3 RadPageViews (one for each tab).
    Inside each individual page view is a RadToolBar.  The toolbar links to other pages within that section of the app.

    When I click on one of the RadToolBarButton's, it resets the selected tab.

    How can I preserve the currently selected tab when different toolbarbuttons are clicked?

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Jun 2010 Link to this post

    Hello Chris,

    I guess you are redirecting to new page on clicking the RadToolBar button and RadTabStrip SelectedIndex is not preserved on the new page (which contains same controls as well). If that, the case, you need to set the SelectedIndex explicitly after redirecting.

    One suggestion to set the correct SelectedIndex is by passing the index as url parameter when redirecting itself. The following code shows how to add url parameter when redirecting.
        protected void RadToolBar2_ButtonClick(object sender, RadToolBarEventArgs e) 
            Response.Redirect("NewPage.aspx?id="+ RadTabStrip1.SelectedIndex); 

    Now in the Page_Load event of NewPage.aspx, you can easily reset the RadTabStrip SelectIndex. Here is code snippet on how to perform this.

        protected void Page_Load(object sender, EventArgs e) 
            if (Page.Request["id"] != null
                RadTabStrip1.SelectedIndex = Convert.ToInt32(Page.Request["id"]); 
                RadMultiPage1.SelectedIndex = RadTabStrip1.SelectedIndex; 

    Could you provide some more information about your scenario, if that is different than what I tried?

  3. DevCraft R3 2016 release webinar banner
Back to Top