0

I'm working on a legacy webforms app. I've added a new radmenuitem to an existing radmenu (see link2 below) but I can't see it when I compile and run the page. The existing link, Link1, appears just fine. I can even change Link1 and see the changes when testing. Link2 doesn't show. I've tried forcing the page to update by making small changes to the code behind but that doesn't work.

<telerik:RadMenu ID="Menu1" runat="server">
<telerik:RadMenuItem Text="Links" Value="Links">
<Items>
<telerik:RadMenuItem Text="Link1" runat="server" Value="Link1" NavigateUrl="http://example.com">
</telerik:RadMenuItem>
<telerik:RadMenuItem Text="Link2" runat="server" Value="Link2" NavigateUrl="http://example.com">
</telerik:RadMenuItem>
</Items>
</telerik:RadMenuItem>
</telerik:RadMenu>

I'm using Visual Studio 2017. Asp.net webforms.

Tom McDonald
  • 1,532
  • 2
  • 18
  • 37
  • You shouldn't need to recompile to see .aspx changes. What happens if you change the text of Link1 to something else? Do you see the change? – Seano666 Mar 16 '18 at 22:22
  • Yes, when you update Link1 you can see the change. Link2, however, won't appear. – Tom McDonald Mar 18 '18 at 19:11
  • If you inspect the produced html - is the second item missing there? If not, then it is a css issue. Can you also try to change the NavigateUrl of the second item to something else, not equal to the url of the first item? I doubt it would make a difference, but still. Do you set any group settings in the backend? Or any manipulation of the items at all? – Veselin Vasilev Mar 19 '18 at 07:08
  • second item is NOT in the HTML. Also the URLs above are just for example purposes. In the real solution they differ. – Tom McDonald Mar 19 '18 at 13:09

2 Answers2

2

You need to add <Items> tag after RadMenu. Look into your final code.

<telerik:RadMenu ID="Menu1" runat="server">
        <Items>
            <telerik:RadMenuItem Text="Links" Value="Links">
            <Items>
            <telerik:RadMenuItem Text="Link1" runat="server" Value="Link1" NavigateUrl="http://example.com">
            </telerik:RadMenuItem>
            <telerik:RadMenuItem Text="Link2" runat="server" Value="Link2" NavigateUrl="http://example.com">
            </telerik:RadMenuItem>
            </Items>
            </telerik:RadMenuItem>
         </Items>
</telerik:RadMenu>
Anant Jaiswal
  • 136
  • 1
  • 9
1

It turned out to be in the code. A custom security feature was hiding certain menu items using the VB.Net code below:

  For Each mItem As RadMenuItem In Menu1.Items
        If mItem.Value.ToUpper() <> "HELP" Then
            mItem.Visible = False
        End If
    Next
Tom McDonald
  • 1,532
  • 2
  • 18
  • 37
  • This is old, but I found this answer useful for setting whether a menu item is visible in the page based on a database value, since RadMenuItem doesn't have an ID property. – Michael Foster Feb 17 '23 at 20:46