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

RadMenu ClickToOpen="true" does not work when using ItemTemplate

1 Answer 142 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Gavin
Top achievements
Rank 1
Gavin asked on 11 Apr 2016, 01:16 PM

I need to use the following ItemTemplate for styling reasons, however ClickToOpen="true" does not work. What needs to be added in order for ClickToOpen to work properly? If I remove the ItemTemplate block it works as expected.

<telerik:RadMenu ID="RadMenu1" runat="server" ClickToOpen="true" Skin="Bootstrap">
    <Items>
        <telerik:RadMenuItem Text="Item 1">
            <ItemTemplate>
                <div class="caption">
                    <a href="#"><span><i></i>Item 1</span></a>
                </div>
            </ItemTemplate>
            <Items>
                <telerik:RadMenuItem Text="Sub Item 1"></telerik:RadMenuItem>
                <telerik:RadMenuItem Text="Sub Item 2"></telerik:RadMenuItem>
                <telerik:RadMenuItem Text="Sub Item 3">
                    <Items>
                        <telerik:RadMenuItem Text="Sub Sub Item 1"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="Sub Sub Item 2"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="Sub Sub Item 3"></telerik:RadMenuItem>
                    </Items>
                </telerik:RadMenuItem>
            </Items>
        </telerik:RadMenuItem>
        <telerik:RadMenuItem Text="Item 2">
            <ItemTemplate>
                <div class="caption">
                    <a href="#"><span><i></i>Item 2</span></a>
                </div>
            </ItemTemplate>
            <Items>
                <telerik:RadMenuItem Text="Sub Item 1"></telerik:RadMenuItem>
                <telerik:RadMenuItem Text="Sub Item 2"></telerik:RadMenuItem>
                <telerik:RadMenuItem Text="Sub Item 3">
                    <Items>
                        <telerik:RadMenuItem Text="Sub Sub Item 1"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="Sub Sub Item 2"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="Sub Sub Item 3"></telerik:RadMenuItem>
                    </Items>
                </telerik:RadMenuItem>
            </Items>
        </telerik:RadMenuItem>
    </Items>
</telerik:RadMenu>

1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 14 Apr 2016, 06:28 AM
Hello Gavin,

The problem in your scenario is the fact that you have an <a> tag within your ItemTemplate that reloads the page. It actually gets fired before the sub-menu is opened. Removing the <a> tag should solve the issue for you.

Regards,
Veselin Tsvetanov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Menu
Asked by
Gavin
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or