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

click event handler for contextmenu items

6 Answers 637 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 21 Sep 2010, 04:31 PM
I think this is an easy one, but I'm not seeing how to do it. I want to write event handlers for the menu items in the radscheduler context menu. For example, I want to write the code for "Next View."

Anybody done this? Thanks in advance for your help. I hope you get lots of points. :)

6 Answers, 1 is accepted

Sort by
0
Dobry Zranchev
Telerik team
answered on 24 Sep 2010, 04:26 PM
Hello revox,

Thank you for writing. If I understand correctly, you want to navigate to the next view and navigate to the previous view through the context menu. In this case when you click the next view item in the context menu you should call method
RadScheduler.NavigateToNextViewCommand.ExecuteCommand(this.associatedScheduler);
For the previous view, you could use
RadScheduler.NavigateToPreviousViewCommand.ExecuteCommand(this.associatedScheduler);

I hope that this will help you. If you have other questions feel free to contact us.

Sincerely yours,
Dobry Zranchev
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
Jim
Top achievements
Rank 1
answered on 28 Sep 2010, 04:58 PM
Thanks for your response! I want to override the click event handlers for the context menu items. (I'm finally getting back to this task.)

It's not the code you wrote that had me stumped. It's how to override the click event handler. As I said originally, this may be an easy one. I'll search the forum for an answer.
0
Brennan
Top achievements
Rank 1
answered on 28 Sep 2010, 06:45 PM
I don't usually try to "override" the Telerik menu items click events, I usually just make their menu items invisible (The one's I don't want/need), add my own menu item, and then handle my menu item's click event.  The code is as follows:

Private Sub radScheduler1_ContextMenuShowing(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.SchedulerContextMenuShowingEventArgs) Handles radScheduler1.ContextMenuShowing
    
'REMOVES NextView FROM CONTEXT MENU
Dim i As Integer = 0
Do While i < e.ContextMenu.Items.Count
   If e.ContextMenu.Items(i).Text = "NextView" Then
      e.ContextMenu.Items(i).Visibility = Telerik.WinControls.ElementVisibility.Collapsed
      Exit Do
    End If
    i += 1
Loop
  
'ADD YOUR OWN NEXTVIEW BUTTON
Dim changeView As RadMenuItem = New RadMenuItem()
e.ContextMenu.Items.Insert(0,changeView)
changeView.Text = "change view"
   
'CREATE THE HANDLER FOR THE BUTTON
AddHandler changeView.Click, AddressOf changeView_Click
    
End Sub
0
Jim
Top achievements
Rank 1
answered on 28 Sep 2010, 09:16 PM
Thanks for the tip!
0
Jim
Top achievements
Rank 1
answered on 30 Sep 2010, 08:00 PM
I got back to this problem and used your approach. It works! Thanks much!
0
Accepted
Brennan
Top achievements
Rank 1
answered on 30 Sep 2010, 10:20 PM
Glad I could help.
Tags
Scheduler and Reminder
Asked by
Jim
Top achievements
Rank 1
Answers by
Dobry Zranchev
Telerik team
Jim
Top achievements
Rank 1
Brennan
Top achievements
Rank 1
Share this question
or