This is a migrated thread and some comments may be shown as answers.

Open in new window

5 Answers 207 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 25 Sep 2008, 06:27 PM
I have a rad menu being popluated by a SiteMapDataSource.  The SiteMapDataSource contains the code that should tell a specific link in the menu to open in a new window.  For some reason, the links are not opening in a new window.  I do not want every link to open in a new window, just the ones that I have designated in my SiteMapDataSource.

By the way, the sitemapdatasource is being created by Sharepoint as I add sites and links.  When I go into sharepoint and select add link, it gives me an option for that link to open in a new window.  This functionallity seems to work in other WebParts and controls.

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 26 Sep 2008, 11:40 AM
Hello Chris,

I verified this behavior. Indeed the builtin menu correctly binds and sets the Target property of its item to "_blank" (so it opens in a new window). Unfortunately RadMenu cannot find the Target property because it does not "know" of SharePoint's PortalSiteMapNode object. The only workaround which I can propose is to use codebehind and subscribe to the ItemDataBound event (perhaps the easiest way to do this is to use an UserControl). Here are the required steps:
  1. Create a new user control (e.g. C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\RadMenu.ascx)
  2. Paste the following code there:
    <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI, Version=2008.2.826.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" 
        Namespace="Telerik.Web.UI" %> 
    <%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" 
        Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
    <%@ Import Namespace="Microsoft.SharePoint" %> 
    <%@ Control Language="C#" AutoEventWireup="true" compilationMode="Always"%> 
    <script runat="server"
    protected void RadMenu1_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e) 
        string target = (string)DataBinder.Eval(e.Item.DataItem, "Target"); 
         
        if (!string.IsNullOrEmpty(target)) 
        { 
            e.Item.Target = target
        } 
    </script> 
    <telerik:RadMenu runat="server" ID="RadMenu1" DataSourceID="topSiteMap" OnItemDataBound="RadMenu1_ItemDataBound"
    </telerik:RadMenu> 
    <SharePoint:DelegateControl ID="DelegateControl1" runat="server" ControlId="TopNavigationDataSource"
        <Template_Controls> 
            <asp:SiteMapDataSource 
              ShowStartingNode="False" 
              SiteMapProvider="SPNavigationProvider" 
              id="topSiteMap" 
              runat="server" 
              StartingNodeUrl="sid:1002"/> 
        </Template_Controls> 
    </SharePoint:DelegateControl> 
  3. Register the control in your master page:
    <%@ Register TagPrefix="wssuc" TagName="RadMenu" src="~/_controltemplates/RadMenu.ascx" %>
  4. Use the control
    <wssuc:RadMenu runat="server" id="RadMenuUserControl"/>

I hope this helps,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Cameron Hart
Top achievements
Rank 1
answered on 28 Jan 2010, 05:35 AM
I'm about to duplicate this fix now.

Before I do, since 2008, has the Rad Menu been upgraded to handle this kind of functionality by default? It would be a very useful timesaver.
0
Peter
Telerik team
answered on 29 Jan 2010, 10:39 AM
Hi Cameron,

Thanks for your inquiry. Unfortunately, RadMenu has not been extended to handle such scenarios automatically. Please, excuse us for this limitation of the control.

All the best,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joaquin
Top achievements
Rank 1
answered on 12 Aug 2010, 09:05 PM
Do you know if the RadMenu has improved or changed that setting in version 2010.1.519?

I'm having the same issue but I want to know how can I do the control on the sever in the hive 12/TEMPLATES, is that the code, or that is the code that goes in the MasterPage?
0
Kamen Bundev
Telerik team
answered on 13 Aug 2010, 09:25 AM
Hi Jesse,

No, this feature is not implemented yet, however we are considering to add it soon.

About your other question - I'm not sure I understand what you are asking. If you follow the steps outlined below, the user control should work (the steps are for SharePoint 2007).

All the best,
Kamen Bundev
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
Tags
Menu
Asked by
Chris
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Cameron Hart
Top achievements
Rank 1
Peter
Telerik team
Joaquin
Top achievements
Rank 1
Kamen Bundev
Telerik team
Share this question
or