Dynamic Context Menu

3 posts, 0 answers
  1. Dasha
    Dasha avatar
    80 posts
    Member since:
    Aug 2010

    Posted 01 Sep 2010 Link to this post

    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. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 01 Sep 2010 Link to this post

    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
  3. Dasha
    Dasha avatar
    80 posts
    Member since:
    Aug 2010

    Posted 01 Sep 2010 Link to this post

    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.

     

     

     

     

Back to Top