Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Menu > How to customize Menu according to design
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered How to customize Menu according to design

Feed from this thread
  • Gourav avatar

    Posted on May 10, 2011 (permalink)

    Hi,
    I have implemented dynamic Mega Menu drop down using RadMenu control and sitemap as a datasource in my web site (Please see the currentMegaMenu.jpg for existing menu), but according client's requirements I have to design this menu according to attached  screen shot (desiredMegaMenu.jpg). 
     
    Below is the code, which i am using for designing a MegaMenu dropdown:-

    protected void asbsMenu_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e)
            {
                if (((SiteMapNode)(e.Item.DataItem)).ChildNodes.Count == 0)
                {
                   return;               
                }
                RadMenuItem childItem = new RadMenuItem();
                e.Item.Items.Add(childItem);

                using (MenuItemTemplate menuItemTemplate = new MenuItemTemplate())
                {
                    menuItemTemplate.InstantiateIn(childItem);
                }
            }

            class MenuItemTemplate : ITemplate, IDisposable
            {
                RadSiteMap subMenuSitemap;
                SiteMapDataSource subMenuDS;
                public void InstantiateIn(Control container)
                {
                    RadMenuItem parentItem = (RadMenuItem)container.Parent;
                    SiteMapNode node = (SiteMapNode)parentItem.DataItem;
                   
                    subMenuDS = new SiteMapDataSource();
                    subMenuDS.ID = parentItem.Text + "dataSource";

                    subMenuDS.StartingNodeUrl = parentItem.NavigateUrl;
                    subMenuDS.ShowStartingNode = true;
                   
                    //add the SiteMapDataSource control to the container controls collection
                    container.Controls.Add(subMenuDS);
                   
                    subMenuSitemap = new RadSiteMap();
                    subMenuSitemap.EnableEmbeddedBaseStylesheet = false;
                    subMenuSitemap.EnableEmbeddedSkins = false;
                   
                    subMenuSitemap.ID = parentItem.TabIndex + "siteMap";
                    subMenuSitemap.DataSource = subMenuDS;
                    subMenuSitemap.LevelSettings.Add(new SiteMapLevelSetting(0));
                    subMenuSitemap.DefaultLevelSettings.ListLayout.RepeatColumns = 2;
                     subMenuSitemap.LevelSettings.Add(new SiteMapLevelSetting(1));
                    subMenuSitemap.DefaultLevelSettings.ListLayout.RepeatColumns = 2;
                   
                    subMenuSitemap.DataBind();
                    subMenuSitemap.GetAllNodes()[0].Text = "";

                    //add the RadSiteMap control to the container controls collection
                    container.Controls.Add(subMenuSitemap);
                }

    I guess, some changes are required in the above lines in bold, Could you please  confirm the changes?

    Regards,
    Gourav

  • Peter Peter admin's avatar

    Posted on May 13, 2011 (permalink)

    Hi Gourav,

    Could you please send us a sample project with the support ticket that you have on this issue?

    All the best,
    Peter
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Menu > How to customize Menu according to design