Radtabstrip focus on page redirection

5 posts, 1 answers
  1. Lubna Ansari
    Lubna Ansari avatar
    65 posts
    Member since:
    Feb 2010

    Posted 21 Apr 2010 Link to this post


    Hi,

    I am using Radtabstrip in a header control which I have placed in my master page. I'm trying to redirect to the specific pages on cliking of tabs in header, which is working fine. The only problem is, the selected tab of Radtabstrip is always the first tab. It is redirecting to correct page but focus is always to tab 0 in Radtabstrip. Following is my html code.

    <

     

    telerik:RadTabStrip ID="RadTabStrip1" runat="server" 

     

     

     

    SelectedIndex="0" CssClass="tabStrip" OnTabClick="RadTabStrip1_TabClick" CausesValidation="false">

     

     

    <Tabs>

     

     

    <telerik:RadTab Text="Home">

     

     

    </telerik:RadTab>

     

     

    <telerik:RadTab Text="Login">

     

     

    </telerik:RadTab>

     

     

    <telerik:RadTab Text="Register">

     

     

    </telerik:RadTab>

     

     

    </Tabs>

     

     

    </telerik:RadTabStrip>

     

     

     


    Below is my code behind

    protected

     

    void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)

     

     

    {

     

     

    string  HTMLTemplatePath =

    ConfigurationSettings.AppSettings["Path"]; 

     

     

    string strCurrentTab = e.Tab.Text;

     

     

    switch (strCurrentTab)

    {

     

     

     

    case "Home":

     

    RadTabStrip1.SelectedIndex=e.Tab.Index;

     

    Response.Redirect(HTMLTemplatePath +

     

    GeneralDeclaration.PAGE_Home);

     

     

     

     

    break;

     

     

     

     

    case "Login":

     

    RadTabStrip1.SelectedIndex = e.Tab.Index;

     

    Response.Redirect(HTMLTemplatePath +

     

    GeneralDeclaration.PAGE_Login);
    break;

     

     

     

    case "Register":

     

    RadTabStrip1.SelectedIndex = e.Tab.Index;

     

    Response.Redirect(HTMLTemplatePath +

     

    GeneralDeclaration.PAGE_Register); 

     

     

     

    break;

     

    }

    }



    Thanks.

     

     

  2. Answer
    Yana
    Admin
    Yana avatar
    5030 posts

    Posted 21 Apr 2010 Link to this post

    Hello Lubna,

    It's expected as you open a new page and new tabstrip is created. You can try to find the clicked tab in Page_Load using the url of the page and set its Selected property to true.

    Kind regards,
    Yana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Andrew Cao
    Andrew Cao avatar
    12 posts
    Member since:
    May 2010

    Posted 27 May 2010 Link to this post

    same problem here, when I create multiple levels of tapstrips on different master page, the focus is always always on the first one after I selected a tap from a lower level. and I did set the selected = ture.
  4. Lubna Ansari
    Lubna Ansari avatar
    65 posts
    Member since:
    Feb 2010

    Posted 28 May 2010 Link to this post

    Hi Andrew,

    What I am doing is on my header control page load event i'm cheking the url and then set the tabs accordingly. Following is my code which might help you.

    protected

     

    void Page_Load(object sender, EventArgs e)

     

    {

     

    string strURL = Request.Url.Segments[2].ToString();

     

     

    switch (strURL)

     

    {

     

    case GeneralDeclaration.PAGE_Home:

     

    RadTabStrip1.SelectedIndex = 0;

     

    break;

     

     

    case GeneralDeclaration.PAGE_Login:

     

    RadTabStrip1.SelectedIndex = 1;

     

    break;

     

     

    case GeneralDeclaration.PAGE_Register:

     

    RadTabStrip1.SelectedIndex = 2;

     

    break;

     

    }

     

     

    }

  5. Andrew Cao
    Andrew Cao avatar
    12 posts
    Member since:
    May 2010

    Posted 28 May 2010 Link to this post

    thanks alot
Back to Top