Context Menu item contentTemplate not showing

2 posts, 0 answers
  1. Robot B9
    Robot B9 avatar
    9 posts
    Member since:
    Oct 2011

    Posted 05 Nov 2014 Link to this post

    Windows 7 pro x64
    VS2008 web page
    Telerik UI for ASP.NET AJAX Q2 2014 - Bin35


    In this simple page, there is a context menu with 3 items
    the third item uses a content template.
    Right click over the text to show the context menu.
    The third item does not show up in the browser but is rendered along with an empty iframe. why?

    my goal is to put some text and a textbox (html element) where the text would normally be in a radMenuItem.
    something like
    <content Template>part number contains: <input type="textbox" /></contentTemplate>
    so that the user can right-click and click in the textbox and type something in. (I can catch the ENTER keystroke and do the post back)

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test_rad_context_menu.aspx.vb" Inherits="test_austin_test_rad_context_menu" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
       <telerik:RadScriptManager runat="server" />
       
       <div id="content">
    right click over me. There should be 3 items.<br />
    right click over me. There should be 3 items.<br />
    right click over me. There should be 3 items.<br />
    right click over me. There should be 3 items.<br />
    right click over me. There should be 3 items.<br />
       </div>

        <telerik:RadContextMenu runat="server" ID="ctxTest">
    <ExpandAnimation Type="None" />
    <CollapseAnimation Type="None" />
    <Items>

    <telerik:RadMenuItem Value="1" Text="item 1 of 3" />
    <telerik:RadMenuItem Value="2" Text="item 2 of 3" />

    <telerik:RadMenuItem Value="3">
    <ContentTemplate>item 3 of 3</ContentTemplate>
    </telerik:RadMenuItem>

    </Items>
    <Targets>
    <telerik:ContextMenuElementTarget ElementID="content" />
    </Targets>
    </telerik:RadContextMenu>
        </form>
    </body>
    </html>








  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 10 Nov 2014 Link to this post

    Hello,

    Please try to use ItemTemplate as shown below:
    //markup code
    <telerik:RadContextMenu runat="server" ID="ctxTest">
               <ExpandAnimation Type="None" />
               <CollapseAnimation Type="None" />
               <Items>
     
                   <telerik:RadMenuItem Value="1" Text="item 1 of 3" />
                   <telerik:RadMenuItem Value="2" Text="item 2 of 3" />
     
                   <telerik:RadMenuItem Value="3">
                       <ItemTemplate>item 3 of 3</ItemTemplate>
                   </telerik:RadMenuItem>
     
               </Items>
               <Targets>
                   <telerik:ContextMenuElementTarget ElementID="content" />
               </Targets>
           </telerik:RadContextMenu>



    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top