Hi,
I have 2 projects:
1) Simple test project - I create RadContextMenu that is associated with grid's row and it appears normally. I create it programmatically in Page_Init event. I don't use ContextMenuControlTarget. Telerik's grid and RadContextMenu are inside user control. The code looks as following:
2) Complex project - I create RadContextMenu that should be associated with grid's row but it doesn't appear at all. I create it without ContextMenuControlTarget programmatically in OnInit method. But when I use ContextMenuControlTarget it appears but it's available not only on grid's row but in grid's header too. I don't need it in grid's header. The code looks as following:
The CreateContextItems method add items to context menu.
How to get rid of context menu appearance in grid's header?
Goran
I have 2 projects:
1) Simple test project - I create RadContextMenu that is associated with grid's row and it appears normally. I create it programmatically in Page_Init event. I don't use ContextMenuControlTarget. Telerik's grid and RadContextMenu are inside user control. The code looks as following:
public partial class GridUserControlDynamic : System.Web.UI.UserControl{ public RadContextMenu contextMenu = new RadContextMenu(); protected void Page_Init(object sender, EventArgs e) { contextMenu.ID = this.GridControl.ID + "_RadMenu"; RadMenuItem item1 = new RadMenuItem("Add"); RadMenuItem item2 = new RadMenuItem("Edit"); RadMenuItem item3 = new RadMenuItem("Delete"); RadMenuItem item4 = new RadMenuItem("Parus"); contextMenu.Items.Add(item1); contextMenu.Items.Add(item2); contextMenu.Items.Add(item3); contextMenu.Items.Add(item4); contextMenu.ItemClick += contextMenu_ItemClick; Controls.Add(contextMenu);2) Complex project - I create RadContextMenu that should be associated with grid's row but it doesn't appear at all. I create it without ContextMenuControlTarget programmatically in OnInit method. But when I use ContextMenuControlTarget it appears but it's available not only on grid's row but in grid's header too. I don't need it in grid's header. The code looks as following:
protected override void OnInit(EventArgs e){ base.OnInit(e); ... // Grid context menu section var contextMenu = new Parus.Controls.GridContextMenu(); var target = new ContextMenuControlTarget(); target.ControlID = this.Grid.ID; contextMenu.ID = this.Grid.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);The CreateContextItems method add items to context menu.
How to get rid of context menu appearance in grid's header?
Goran