Hi,
The Telerik's grid is incorporated in our user control (derived from UserControl). I had a requirement to allow context menu to show up on grid's row and we use RadContextMenu in conjunction with ContextMenuControlTarget. Actually, I have to use ContextMenuControlTarget. I have a simple test project where everything works fine with RadContextMenu only. But, in our main complex project I have to use ContextMenuControlTarget to show grid's context menu. If I don't use it the context menu doesn't appear. I don't know why.
So, I'm not sure when to use RadContextMenu only and when with ContextMenuControlTarget.
There's another issue. When I use ContextMenuControlTarget the context menu appears not only when I select grid's row but in header as well. We don't need the context menu to appear in header.
Here's the code I use:
My question is - how can I get rid of ContextMenuControlTarget or if it's not possible how to disallow it to appear in grid's header?
The Telerik's grid is incorporated in our user control (derived from UserControl). I had a requirement to allow context menu to show up on grid's row and we use RadContextMenu in conjunction with ContextMenuControlTarget. Actually, I have to use ContextMenuControlTarget. I have a simple test project where everything works fine with RadContextMenu only. But, in our main complex project I have to use ContextMenuControlTarget to show grid's context menu. If I don't use it the context menu doesn't appear. I don't know why.
So, I'm not sure when to use RadContextMenu only and when with ContextMenuControlTarget.
There's another issue. When I use ContextMenuControlTarget the context menu appears not only when I select grid's row but in header as well. We don't need the context menu to appear in header.
Here's the code I use:
public class GridContextMenu : RadContextMenu{ ...}protected override void OnInit(EventArgs e)
{
base.OnInit(e);
var contextMenu = new Parus.Controls.GridContextMenu();
var target = new ContextMenuControlTarget(); target.ControlID = this.GridControl.ID;
contextMenu.ID = this.GridControl.ID + "_RadMenu";
CreateContextItems(contextMenu.Items, this.Frame.ViewFrameData.ActionItems);
contextMenu.LinkedControlClientId = ServerRequest.ClientID; contextMenu.OnClientItemClicked = "GridContextMenu_ActionsHandler";
contextMenu.Targets.Add(target);
this.PostbackPanel.ContentTemplateContainer.Controls.Add(contextMenu);
...
}
My question is - how can I get rid of ContextMenuControlTarget or if it's not possible how to disallow it to appear in grid's header?