I have a bunch of custom html elements being generated by user controls in my web page, but I'm having a hard time getting them set as targets for the context menu. The following doesn't seem to work:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TelerikTest1._Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!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
>
<
script
src
=
"Scripts/jquery-1.4.1.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"Scripts/jquery-1.4.1.min.js"
type
=
"text/javascript"
></
script
>
<
script
language
=
"javascript"
>
function TokenContextMenu_Clicked(sender, args)
{
var menuItemValue = args.get_item().get_value();
if (menuItemValue == "DefineDictionaryItem")
{
alert("Success!");
}
}
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
telerik:RadContextMenu
ID
=
"TokenContextMenu"
runat
=
"server"
OnClientItemClicked
=
"TokenContextMenu_Clicked"
>
<
Targets
>
<
telerik:ContextMenuTagNameTarget
TagName
=
"text_token"
/>
</
Targets
>
<
Items
>
<
telerik:RadMenuItem
runat
=
"server"
Text
=
"Define Dictionary Item"
Value
=
"DefineDictionaryItem"
/>
</
Items
>
</
telerik:RadContextMenu
>
<
div
>
<
text_token
id
=
"text_token_1"
>Thisisatesttoken1!</
text_token
>
<
text_token
id
=
"text_token_2"
>Thisisatesttoken2!</
text_token
>
</
div
>
</
form
>
</
body
>
</
html
>