How to prevent submenu from displaying

4 posts, 0 answers
  1. Steve
    Steve avatar
    9 posts
    Member since:
    Jun 2009

    Posted 20 Aug 2012 Link to this post

    How do you prevent the RadMenu from displaying the submenu items as a drop down.

    For example:

    + Home
    + Services
       - Coding
       - Web Design
       - SQL Server
    + Contact

    I only want to display: Home | Services | Contact

    Thanks!
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Aug 2012 Link to this post

    Hi Steve,

    You can set CSS class for the menu items as shown below.
    aspx:
    <telerik:RadMenu  ID="menu2"  runat="server"  ClickToOpen="true">
     <Items>
       <telerik:RadMenuItem Text="Services">
          <Items>
            <telerik:RadMenuItem Text="Coding"   CssClass="hide" ></telerik:RadMenuItem>
            <telerik:RadMenuItem Text="Web design" CssClass="hide" ></telerik:RadMenuItem>
            <telerik:RadMenuItem Text="SQL Server" CssClass="hide" ></telerik:RadMenuItem>
          </Items>
       </telerik:RadMenuItem>
      </Items>
    </telerik:RadMenu>
    CSS:
    .hide
     {
       display:none !important;
     }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steve
    Steve avatar
    9 posts
    Member since:
    Jun 2009

    Posted 21 Aug 2012 Link to this post

    Thanks for your input!

    I am using a datasource, not declaratively creating the items?
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 22 Aug 2012 Link to this post

    Hi Steve,

    Try the following code snippet to achieve your scenario.

    C#:
    protected void RadMenu1_ItemCreated(object sender, Telerik.Web.UI.RadMenuEventArgs e)
     {
       if (e.Item is RadMenuItem)
         {
           if (e.Item.Parent != null && e.Item.Parent is RadMenuItem)
             {
               e.Item.Visible = false;
             }
         }
     }

    Hope this helps.

    Regards,
    Princy.
Back to Top