More in this section

Forums / Developing with Sitefinity / how to show title/tooltip for sitepanelbar and sitetree on mouseover ?

how to show title/tooltip for sitepanelbar and sitetree on mouseover ?

5 posts, 1 answered
  1. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    02 Jun 2010
    Link to this post
    Hi sir,


    Iam doing web development using sitefinity. I need a solution from you for the question below.

    how to show title/tooltip for sitepanelbar and sitetree on mouseover ?

    I tried with some possibilities but failed to achieve...pls help me.

    Thanks,
    sathiya
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    02 Jun 2010
    Link to this post
    Hello sathiyaseelan,

    For SiteTabstrip edit the file ~/Sitefinity/UserControls/Navigation35/SiteTabstrip.ascx.cs as bellow:
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.ShowOnlyFirstLevel)
        {
            SiteMapNode rootNode = SiteMap.RootNode;
            foreach (SiteMapNode node1 in rootNode.ChildNodes)
            {
                RadTab tab = new RadTab();
                tab.Text = node1.Title;
                tab.NavigateUrl = node1.Url;
                tab.ToolTip = ((CmsSiteMapNode)node1).GetCmsPage().Description;
                this.RadTabstrip1.Tabs.Add(tab);
            }
     
            CmsSiteMapNode currentNode = SiteMap.CurrentNode as CmsSiteMapNode;
     
            if (currentNode != null && currentNode.ParentNode != null)
            {
                while (currentNode.ParentNode != rootNode)
                {
                    CmsSiteMapNode tempNode = currentNode.ParentNode as CmsSiteMapNode;
                    if (tempNode == null)
                        break;
                    currentNode = tempNode;
                }
                RadTab item = this.RadTabstrip1.FindTabByUrl(this.ResolveUrl(currentNode.Url));
                if (item != null)
                {
                    // here you can set the style for the top-level item  
                    item.Selected = true;
                }
            }
            else if (this.RadTabstrip1.Tabs.Count > 0)
            {
                this.RadTabstrip1.Tabs[0].Selected = true;
            }
        }
        else
        {
            SiteMapNode root = this.GetStartingNode();
            FillTabStrip(root, this.RadTabstrip1.Tabs, 0);
        }
    }
    ...
    private void FillTabStrip(SiteMapNode pNode, RadTabCollection pTabs, int levelDepth)
    {
        int levelPosition = -1;
        foreach (CmsSiteMapNode node in pNode.ChildNodes)
        {
            levelPosition++;
     
            RadTab tab = new RadTab(node.Title);
            tab.NavigateUrl = node.Url;
            tab.ToolTip = node.GetCmsPage().Description;
     
            pTabs.Add(tab);
            if (node == SiteMap.CurrentNode)
            {
                tab.Selected = true;
                tab.Owner.SelectedIndex = levelPosition;
            }
     
            if (levelDepth > this.HierarchyDepth && this.HierarchyDepth != -1)
                tab.Visible = false;
     
            if (levelDepth == this.HideLevel)
                tab.Style.Add(HtmlTextWriterStyle.Display, "none");
     
            this.FillTabStrip(node, tab.Tabs, levelDepth + 1);
     
            if (tab.SelectedIndex >= 0)
                tab.Owner.SelectedIndex = levelPosition;
        }
    }

    For SitePanelbar edit the file ~/Sitefinity/UserControls/Navigation35/SitePanelbar.ascx.cs as bellow:
    public void RadPanelbar1_ItemDataBound(object sender, RadPanelBarEventArgs e)
    {
        CmsSiteMapNode node1 = e.Item.DataItem as CmsSiteMapNode;
        e.Item.ToolTip = node1.GetCmsPage().Description;
        if (this.hideUrlForGroupPages)
        {
            CmsSiteMapNode node = e.Item.DataItem as CmsSiteMapNode;
            if (node != null && node.PageType == CmsPageType.Group)
            {
                e.Item.NavigateUrl = "";
            }
        }
    }

    Both methods will fill in tool tip with the respective page's description (which is set in the page's properties section).

    Best wishes,
    Radoslav Georgiev
    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.
    Answered
  3. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    02 Jun 2010
    Link to this post
    Hi sir,

    Thank you very much for your quick reply. I got this and can you please how can we do for "SiteTreeView" that generates sitemap.

    Thanks in advance,
    sathiya
  4. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    02 Jun 2010
    Link to this post
    Hi sir,

    i got a solution for sitetreeview from your reply.

     

    public void RadTreeview1_NodeBound(object o, RadTreeNodeEventArgs e)

     

    {


     

    CmsSiteMapNode node1 = e.Node.DataItem as CmsSiteMapNode;

     

    e.Node.ToolTip = node1.GetCmsPage().Title.ToUpper();

    }

    Thanks,
    sathiya
  5. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    02 Jun 2010
    Link to this post
    Hi sathiyaseelan,

    I am happy to see that you were able to resolve the problem.

    Sincerely yours,
    Radoslav Georgiev
    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.
Register for webinar
5 posts, 1 answered