+1-888-365-2779
Try Now
More in this section

Forums / 3.x Pre-release forums (retired) / Bug with TabRadStrip?

Bug with TabRadStrip?

4 posts, 0 answered
  1. Ben Alexandra
    Ben Alexandra avatar
    215 posts
    Registered:
    15 Sep 2012
    26 Jan 2007
    Link to this post

    Hi,

    I have the following code in the .cs of my masterpage.  It work perfectly in a fresh project in VS2005, but in Sitefinity it's not quite working.

    Here's what I'm trying to do:  I have my navigation broken into 2 areas (level 1 nav at the top in a tab strip, levels 2 & 3 on the left in a treeview).  The tabstrip is showing level 1 fine and the treeview on the left is working perfectly (wrote some code to start the node based on current level 1 position).

    Here's what's NOT working: The tabstrip at the top is not showing me what level 1 node they are currently on.  Like I said, the code below should work and does in VS2005, but not inside Sitefinity.

    What I've seen: When I do a Watch with my VS2005 for the Sitefinty project, everything works up to the line:
                    Tab tab = RadTabStrip1.FindTabByUrl(smn1.Url);
    smn1.Url shows "~/medicine/index.aspx" (as it should) and if I navigate the properties of RadTabStrip1.Tabs[2].NavigateUrl shows "~/medicine/index.aspx"  (Just as above).

    Fully seems like it should work, but it just doesn't and it returns null for tab.

    Any ideas?

    Let me know if you have any more questions of if I can clarify.

    Thanks 

    Ben

    PS Here's the code for the Page_Load of the master page.

            //For TabStrip
            try
            {
                SiteMapNode smn1 = SiteMap.CurrentNode;
                //string sTopURL = smn1.Url.ToString();
                if (smn1 != null)
                {
                    while ((smn1.ParentNode != null) && (smn1.ParentNode.ParentNode != null))
                    {
                        smn1 = smn1.ParentNode;
                    }
                    RadTabStrip1.DataBind();

                    Tab tab = RadTabStrip1.FindTabByUrl(smn1.Url);
                    if (tab != null)
                    {
                        tab.Selected = true;
                    }
                }
            }
            catch
            {
                // Ignore errors
            }       

  2. Bob
    Bob avatar
    330 posts
    Registered:
    24 Sep 2012
    26 Jan 2007
    Link to this post
    Hello Ben,

    You need to resolve the path before passing it to the FindTabByUrl method.
    Please see the example form this link:
    http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-gmckt.aspx .


    Greetings,
    Bob
    the telerik team
  3. Ben Alexandra
    Ben Alexandra avatar
    215 posts
    Registered:
    15 Sep 2012
    26 Jan 2007
    Link to this post
    Thank you Bob!  Yeah, I just changed the one line to:

    Tab tab = RadTabStrip1.FindTabByUrl(this.ResolveUrl(smn1.Url));

    That fixed it.  I thought I'd drop that one line in here to save other people with the same issue having to download the whole project you linked to just to find the answer ;)

    Another follow up question: I'd like to be able to have people click on the selected tab at the top in order to be able to get back to root of that node.  Once a tab is selected, though, it's not a link any more.  It shows the link where it would go in the status bar, but it's not active.  I tried setting it with code:

        RadTabStrip1.SelectedTab.NavigateUrl = smn1.Url;

    but that didn't do anything.  Any ideas of how to do this?

    Thanks

    Ben

  4. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    29 Jan 2007
    Link to this post
    Hello Ben,

    You can set the r.a.d.tabstrip property

    ClickSelectedTab="True"

    in design mode or declaratively in the HeaderNavigation.ascx user control definition.

    Kind regards,
    Rebecca
    the telerik team
Register for webinar
4 posts, 0 answered