RadStrip selecting tab on postback

2 posts, 0 answers
  1. celerity12
    celerity12 avatar
    6 posts
    Member since:
    Jun 2013

    Posted 16 Aug 2013 Link to this post

     I have the below radstrip and i am adding the tabs in page load as shown below

    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Visible="false"
    OnTabClick="RadTabStrip1_TabClick" AutoPostBack="true" >
    </telerik:RadTabStrip>

    <telerik:RadGrid ID="RadGrid1" runat="server" Width="100%" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="false" PageSize="2"  

                    ShowStatusBar="true" AllowFilteringByColumn="true"  Skin="Sitefinity" OnItemDataBound="RadGrid1_ItemDataBound" Font-Size="9px" >
    In Page Load

    RadTabStrip1.Tabs.Clear();
    RadTabStrip1.Visible = true;
    tabExpired = new RadTab();
    tabExpired.Text = "Expired";
    tabExpiringIn7 = new RadTab();
    tabExpiringIn7.Text = "7 Days";
    RadTabStrip1.Tabs.Add(tabExpired);
    RadTabStrip1.Tabs.Add(tabExpiringIn7);
     
    if (!Page.IsPostBack)
    {
        qcer = new QReport();
        hideColumnDT(qcer.getColumns());
        dt = qcer.getDT("EXPIRED");
        //tabExpired.Selected = true;
        RadTabStrip1.Tabs[0].Selected = true;
        RadTabStrip1.Tabs[0].BackColor = System.Drawing.Color.Red;
    }else{
                //tabExpired.Selected = false;
                RadTabStrip1.Tabs[1].Selected = true;
                RadTabStrip1.Tabs.FindTabByText("7 Days").Selected = true;
                RadTabStrip1.Tabs[1].BackColor = System.Drawing.Color.Red;
     
                qcer = new QReport();
                hideColumnDT(qcer.getColumns());
                dt = qcer.getDT("7 DAYS");
            }
    On page load it shows expired tab selected but when doing postback the tab is not changing ....

    Even trying to do in the tabClick as below but no luck

    protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
            {
               if (e.Tab.Text.Equals("7 Days"))
               {
                   RadTabStrip1.Tabs[1].Selected = true;
                   RadTabStrip1.Tabs.FindTabByText("7 Days").Selected = true;
                   RadTabStrip1.Tabs[1].ForeColor = System.Drawing.Color.Red;
                   e.Tab.Selected = true;
                   e.Tab.Enabled = true;
                   e.Tab.Focus();
                }
    }

    Please help
  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1803 posts

    Posted 20 Aug 2013 Link to this post

    Hi Amit,

    I have tested your code on my side and the selected tab is changed to "tabExpiringIn7" tab on postback.

    I am attaching a simple project with your scenario that works as expected on my side. Please give it a try and see if it works on your side too.
     

    Best Regards,
    Konstantin Dikov
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top