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

Context Menu item contentTemplate not showing

1 Answer 73 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Robot B9
Top achievements
Rank 2
Robot B9 asked on 05 Nov 2014, 09:49 PM
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>








1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 10 Nov 2014, 03:25 PM
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.

 
Tags
Menu
Asked by
Robot B9
Top achievements
Rank 2
Answers by
Boyan Dimitrov
Telerik team
Share this question
or