I'm trying to implement a context menu in a grid with Prometheus. I've done it in RadControls for ASP.NET without any problems.
When calling the radContextMenu1.Show() method I will get an error message saying that the method is not supported.
Any idea about what is wrong?
Thanks
/Mats
-----------------------------------------------------------------------
default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<script type="text/javascript">
function ShowContextMenu()
{
var contextMenu = <%= RadContextMenu1.ClientID %>;
contextMenu.Show();
}
</script>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource">
<ExportSettings>
<Pdf FontType="Subset" PaperSize="Letter" />
<Excel Format="Html" />
</ExportSettings>
<ClientSettings>
<ClientEvents OnRowContextMenu="ShowContextMenu" />
</ClientSettings>
<MasterTableView CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst"
Dir="LTR" Frame="Border" TableLayout="Auto">
<EditFormSettings>
<EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">
</EditColumn>
</EditFormSettings>
<ExpandCollapseColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"
Resizable="False" Visible="False">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<RowIndicatorColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"
Visible="False">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
</MasterTableView>
</telerik:RadGrid>
<telerik:RadContextMenu ID="RadContextMenu1" runat="server" Flow="Horizontal">
<DefaultGroupSettings ExpandDirection="Auto" Flow="Vertical" />
<CollapseAnimation Duration="200" Type="OutQuint" />
<ExpandAnimation Type="OutQuart" />
<Items>
<telerik:RadMenuItem runat="server" ExpandMode="ClientSide" Text="Rad 1">
<GroupSettings ExpandDirection="Auto" Flow="Vertical" />
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" ExpandMode="ClientSide" Text="Rad 2">
<GroupSettings ExpandDirection="Auto" Flow="Vertical" />
</telerik:RadMenuItem>
</Items>
</telerik:RadContextMenu>
</div>
</form>
</body>
</html>
-----------------------------------------------------------------------
default.aspx.cs:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public DataView Source()
{
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("Item", Type.GetType("System.String")));
DataRow dr;
dr = dt.NewRow();
dr[0] = "Use context menu on me...";
dt.Rows.Add(dr);
DataView dv = new DataView(dt);
return dv;
}
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
RadGrid1.DataSource = Source();
}
}