Child menu items not displaying underneath main menu items.

2 posts, 0 answers
  1. Brad
    Brad avatar
    1 posts
    Member since:
    Mar 2008

    Posted 21 Sep 2008 Link to this post

    Hi,
    I'm binding a RadMenu directly to an ArrayList (not through an ObjectDataSource), but the child items are displaying to the right, and not underneath as one would expect. I've copied the example code from http://www.telerik.com/help/aspnet-ajax/menu_dataobjectdatasources.html using the 'Binding to an ArrayList' example word-for-word and can't seem to figure out why? I've tested in IE 7 & FF3.

    My design code:
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
           
            <telerik:RadMenu ID="RadMenu1" Flow="Horizontal" runat="server">
            </telerik:RadMenu>
           
        </div>
        </form>
    </body>

    and code behind:
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    RadMenu1.DataTextField = "Text";
                    RadMenu1.DataNavigateUrlField = "Url";
                    RadMenu1.DataFieldID = "ID";
                    RadMenu1.DataFieldParentID = "ParentID";
                    RadMenu1.DataSource = GenerateSiteData();
                    RadMenu1.DataBind();

                    
                }
            }
            private ArrayList GenerateSiteData()
            {
                ArrayList siteData = new ArrayList();
                siteData.Add(new SiteDataItem(1, null, "All Sites", ""));
                siteData.Add(new SiteDataItem(2, 1, "Search Engines", ""));
                siteData.Add(new SiteDataItem(3, 1, "News Sites", ""));
                siteData.Add(new SiteDataItem(4, 2, "Yahoo", "http://www.yahoo.com"));
                siteData.Add(new SiteDataItem(5, 2, "MSN", "http://www.msn.com"));
                siteData.Add(new SiteDataItem(6, 2, "Google", "http://www.google.com"));
                siteData.Add(new SiteDataItem(7, 3, "CNN", "http://www.cnn.com"));
                siteData.Add(new SiteDataItem(8, 3, "BBC", "http://www.bbc.co.uk"));
                siteData.Add(new SiteDataItem(9, 3, "FOX", "http://www.foxnews.com"));
                return siteData;
            }

        }

        public class SiteDataItem
        {
            private string _text;
            private string _url;
            private int _id;
            private int? _parentId;
            public string Text
            {
                get { return _text; }
                set { _text = value; }
            }
            public string Url
            {
                get { return _url; }
                set { _url = value; }
            }
            public int ID
            {
                get { return _id; }
                set { _id = value; }
            }
            public int? ParentID
            {
                get { return _parentId; }
                set { _parentId = value; }
            }
            public SiteDataItem(int id, int? parentId, string text, string url)
            {
                _id = id;
                _parentId = parentId;
                _text = text;
                _url = url;
            }
        }

    I'm using the 'RadControls 'Prometheus' for ASPNET Q3 2007'
    Thanks.

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 22 Sep 2008 Link to this post

    Hi Brad,

    Please make sure you are using the current official release of RadMenu (assembly version should be 2008.02.826).

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top