More in this section

Forums / Developing with Sitefinity / Menu Link Opens in a New Window

Menu Link Opens in a New Window

2 posts, 0 answered
  1. Erik
    Erik avatar
    34 posts
    06 Dec 2007
    02 Apr 2008
    Link to this post
    I need the ability to have a link in the menu control be able to open an external page in a new window as opposed to opening in the current one.  For my users this would be helpful and more intuitive.  Is there a way to specify this in the control template somewhere?

  2. Pepi
    Pepi avatar
    981 posts
    31 Jan 2017
    03 Apr 2008
    Link to this post
    Hi Erik,

    I would recommend you make a copy of ~/Sitefinity/UserControls/Navigation/SiteMenu.ascx control that is shipped with Sitefinity and modify it according to your requirements to open external pages in a new window. For example, you could implement the desired functionality in the method handling OnItemDataBound event of the menu control:

    public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e)  
            CmsSiteMapNode cmsNode = e.Item.DataItem as CmsSiteMapNode;  
            if (cmsNode != null && cmsNode.CmsPage.PageType == CmsPageType.External)  
                e.Item.Attributes.Add("onclick""'" + cmsNode.CmsPage.ExternalUrl + "')");  
                e.Item.NavigateUrl = "";  

    Another solution is to set "_blank" for the Target property of the menu item:

    e.Item.Target = "_blank"

    Hope this helps.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
2 posts, 0 answered