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

Add TimeSlotContextMenus Items Server Side

1 Answer 37 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
codispdp
Top achievements
Rank 1
codispdp asked on 13 May 2010, 03:00 PM
I am trying to add time slot context menu items from server side using business class that returns a List(of). I cannot get the items to display, can someone lend some assistance please?

<telerik:RadSchedulerContextMenu runat="server" ID="SchedulerTimeSlotContextMenu" > 
                    <Items> 
                        <telerik:RadMenuItem Text="New Appointment" ImageUrl="Images/new.gif" Value="CommandAddAppointment" /> 
                        <telerik:RadMenuItem Text="New Recurring Appointment" ImageUrl="Images/recurring.gif" Value="CommandAddRecurringAppointment" /> 
                        <telerik:RadMenuItem IsSeparator="true" /> 
                        <%-- Custom command --%> 
                        <telerik:RadMenuItem Text="Group by Calendar" Value="EnableGrouping" /> 
                        <telerik:RadMenuItem IsSeparator="true" /> 
                        <telerik:RadMenuItem  Text="Change Scheduler Location" > 
                          
                        </telerik:RadMenuItem> 
    </Items> 
                </telerik:RadSchedulerContextMenu>  


 Protected Sub LoadLocationSchedulerContextMenuItems()  
 
        Dim objScheduler As New Scheduler  
        Dim lLocations As New System.Collections.Generic.List(Of Locations)()  
        Dim ChangeSchedulerLocationMenu As RadMenuItem = RadScheduler1.TimeSlotContextMenus(0).Items(4)  
 
        lLocations = objScheduler.GetLocations(m_CTSession.CTContext.OPP.GroupID)  
 
        For Each obj As Locations In lLocations  
            Dim LocationMenuItem As New RadMenuItem  
            LocationMenuItem.Text = obj.LocationShortName  
            LocationMenuItem.Value = obj.LocationId  
            ChangeSchedulerLocationMenu.Items.Add(LocationMenuItem)  
        Next 
 
        ChangeSchedulerLocationMenu.DataBind()  
 
        objScheduler = Nothing 
        lLocations = Nothing 
 
    End Sub 

1 Answer, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 14 May 2010, 11:58 AM
Hello codispdp,

Note that the RadMenuItems collection is zero based and also separator items are treated as regular items. With this code you actually access the separator item:

Dim ChangeSchedulerLocationMenu As RadMenuItem = RadScheduler1.TimeSlotContextMenus(0).Items(4

To access the last item, please use - RadScheduler1.TimeSlotContextMenus(0).Items(5)



Regards,
Peter
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.
Tags
Scheduler
Asked by
codispdp
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or