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

How to prevent submenu from displaying

3 Answers 126 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 20 Aug 2012, 09:06 PM
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!

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Aug 2012, 05:02 AM
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.
0
Steve
Top achievements
Rank 1
answered on 21 Aug 2012, 02:28 PM
Thanks for your input!

I am using a datasource, not declaratively creating the items?
0
Princy
Top achievements
Rank 2
answered on 22 Aug 2012, 09:00 AM
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.
Tags
Menu
Asked by
Steve
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Steve
Top achievements
Rank 1
Share this question
or