This is a migrated thread and some comments may be shown as answers.

Dynamic Context Menu

2 Answers 127 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Dasha
Top achievements
Rank 1
Dasha asked on 01 Sep 2010, 11:44 AM
Hello, I'm creating a RadScheduler context menu dynamically.  I call the method to create the menu in the Page Onload event.  This works great unti I switch a view.  Even though in the OnLoad event I can see that the Scheduler has my custom context menu items, when I right-click, I get the default menu shown.  Is this something that has a workaround?

2 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 01 Sep 2010, 02:52 PM
Hello Dasha,

Page_Load event is not the correct event to create dynamic context menus to the RadScheduler. You need to override the OnInit event:

protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        RadScheduler1.TimeSlotContextMenus.Clear();
        RadSchedulerContextMenu contextMenu = new RadSchedulerContextMenu();
        contextMenu.ID = "SchedulerTimeSlotContextMenu";
        contextMenu.Items.Add(new RadMenuItem("Test"));
        RadScheduler1.TimeSlotContextMenus.Add(contextMenu);
    }

Hope this helps.

All the best,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Dasha
Top achievements
Rank 1
answered on 01 Sep 2010, 03:11 PM
Oooh, awesome, thank you.

I was also trying to put the code into

protected void Page_Init(object sender, EventArgs e),

 

and it wasn't working, but this way worked great.

 

 

 

 

Tags
Scheduler
Asked by
Dasha
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Dasha
Top achievements
Rank 1
Share this question
or