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

Is there any sample code or function for this?

2 Answers 73 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Urt
Top achievements
Rank 1
Urt asked on 02 Sep 2009, 02:44 PM
I am trying to do RadMenu by reading all content from XML file.  And adding some item elements to the menu on C# code like the one on the video tutorial.  the C# code is the following:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Xml;
using Telerik.Web.UI;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void RadMenu1_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e)
    { 
        XmlElement element = e.Item.DataItem as XmlElement;
        if (element.Attributes["ParentID"].Value == "Carriers")
        {
            e.Item.Width = Unit.Pixel(228);
            Telerik.Web.UI.RadMenuItem mItem = e.Item.Parent as RadMenuItem;
            XmlElement elements = e.Item.DataItem as XmlElement;
            
            Panel CarriersLink = CreateCarriersNavigation(elements.Attributes["LogoLocation"].Value,
                                                          elements.Attributes["NavigateUrl"].Value);
            
            e.Item.Controls.Add(CarriersLink);
        }
    }
    private Panel CreateCarriersNavigation(string LogoLocationSrc, string NavigateUrlSrc)
    {
        Panel CarriersNavigationPanel = new Panel();
        
        Image CarriersLogo = new Image();
        CarriersLogo.ImageUrl = LogoLocationSrc;
                
        HyperLink CarriersLogoLink = new HyperLink();
        CarriersLogoLink.ImageUrl = LogoLocationSrc;
        CarriersLogoLink.NavigateUrl = NavigateUrlSrc;
       
        CarriersNavigationPanel.Controls.Add(CarriersLogoLink);

        return CarriersNavigationPanel;
    }
}

Please refer to picture below:

http://img524.imageshack.us/img524/3631/26999155.png

My questions would be:

1)  How can I add the item (element) by 4 rows and 4 columns (total 16 items).  As you can see from the picture, the item is added below, so there is only 1 column and lots of row items.  I want to do 4 rows items, then start new column by adding others items.  So if I have 16 items, then it would be 4 rows and 4 columns

2)  Those logo are the link to external link.  It does work.  However when click on it, it will replace the current page.  How do I make it to open in the new tab or new window.   For example, <a href=http://www.newsite.com target='_blank'>new site</a> will open that page in the new page.  But I cannot do that since the code need to be in C# (the copy of code is above).

Thanks in advance
  

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 03 Sep 2009, 07:06 AM
Hi Urt,

Currently RadMenu does not support columns. The good news is that we are working on that feature and it should be ready for the upcoming Q3 2009 release which is due November.

You should use the Target property of the HyperLink to make it open in a new window.

Kind regards,
Albert,
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
Urt
Top achievements
Rank 1
answered on 05 Nov 2009, 05:43 PM
Any update of the Q3 2009 products which has the functionality of what I try to achieve: columns support on RadMenu (Please refer to the first post picture link).  Thanks

Edit:
Never mind, It come out on November 3, 2009.  I will get it then.  Thanks
Tags
Menu
Asked by
Urt
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Urt
Top achievements
Rank 1
Share this question
or