Hi
I wanna create a custom server control (from CompositeControl base) that has context menu by default
by something like this :
protected override void CreateChildControls()
{
base.CreateChildControls();
Panel pnl = new Panel();
pnl.ID = "pnl";
pnl.Width = Unit.Pixel(100);
pnl.Height = Unit.Pixel(100);
pnl.BackColor = System.Drawing.Color.Black;
this.Controls.Add(pnl);
RadContextMenu cntMenu = new RadContextMenu();
cntMenu.ID = "cntM";
RadMenuItem mItem = new RadMenuItem("Delete");
cntMenu.Items.Add(mItem);
ContextMenuElementTarget target = new ContextMenuElementTarget();
target.ElementID = pnl.ClientID;
this.Controls.Add(cntMenu);
}
But it does not work
Is it possible to add ContextMenu dynamically ?
Have I done something wrong ?
Thank you very much for your feedbacks
I wanna create a custom server control (from CompositeControl base) that has context menu by default
by something like this :
protected override void CreateChildControls()
{
base.CreateChildControls();
Panel pnl = new Panel();
pnl.ID = "pnl";
pnl.Width = Unit.Pixel(100);
pnl.Height = Unit.Pixel(100);
pnl.BackColor = System.Drawing.Color.Black;
this.Controls.Add(pnl);
RadContextMenu cntMenu = new RadContextMenu();
cntMenu.ID = "cntM";
RadMenuItem mItem = new RadMenuItem("Delete");
cntMenu.Items.Add(mItem);
ContextMenuElementTarget target = new ContextMenuElementTarget();
target.ElementID = pnl.ClientID;
this.Controls.Add(cntMenu);
}
But it does not work
Is it possible to add ContextMenu dynamically ?
Have I done something wrong ?
Thank you very much for your feedbacks