
I need to completly disable the timeSlotContextMenus for all TimeSlots in the monthly view. Client side or server side, wither will work.
Thanks
Joe
3 Answers, 1 is accepted
If you are using server binding for RadScheduler the following code should do exactly what you need:
<
telerik:RadScheduler
ID
=
"RadScheduler1"
runat
=
"server"
SelectedView
=
"MonthView"
TimeSlotContextMenuSettings-EnableDefault
=
"true"
OnNavigationComplete
=
"RadScheduler1_NavigationComplete"
>
</
telerik:RadScheduler
>
protected
void
RadScheduler1_NavigationComplete(
object
sender, SchedulerNavigationCompleteEventArgs e)
{
if
(e.Command == SchedulerNavigationCommand.SwitchToMonthView){
RadScheduler1.TimeSlotContextMenuSettings.EnableDefault =
false
;
}
else
{
RadScheduler1.TimeSlotContextMenuSettings.EnableDefault =
true
;
}
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(RadScheduler1.SelectedView == SchedulerViewType.MonthView){
RadScheduler1.TimeSlotContextMenuSettings.EnableDefault =
false
;
}
}
All the best,
Ivana
the Telerik team

Perhaps this is a better question: How do I switch context menus? I want to use TimeSlotDidabledContectMenu for monthly and timeline views and SchedulerTimeSlotContextMenu for all other views.
<TimeSlotContextMenus>
<telerik:RadSchedulerContextMenu ID="SchedulerTimeSlotContextMenu" runat="server" Skin="Outlook">
<Items>
<telerik:RadMenuItem Text="" />
<telerik:RadMenuItem IsSeparator="True" />
<telerik:RadMenuItem Text="New Job" />
<telerik:RadMenuItem Text="New Task" />
<telerik:RadMenuItem IsSeparator="True" />
<telerik:RadMenuItem Text="Google Route" />
<telerik:RadMenuItem IsSeparator="True" />
<telerik:RadMenuItem Text="Go to today" Value="CommandGoToToday" />
<telerik:RadMenuItem Text="Show 24 hours" Value="CommandShow24Hours" />
</Items>
</telerik:RadSchedulerContextMenu>
<telerik:RadSchedulerContextMenu ID="TimeSlotDidabledContectMenu" runat="server" Skin="Outlook" Enabled="false"></telerik:RadSchedulerContextMenu>
</TimeSlotContextMenus>
If you use server-side binding then the following JavaScript should do the job:
function
pageLoad() {
var
scheduler = $find(
"<%= RadScheduler1.ClientID%>"
);
if
(scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.MonthView
|| scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.TimelineView) {
scheduler.set_timeSlotContextMenuIDs([
"TimeSlotDidabledContectMenu"
]);
}
else
{
scheduler.set_timeSlotContextMenuIDs([
"SchedulerTimeSlotContextMenu"
]);
}
}
<
telerik:RadScheduler
ID
=
"RadScheduler1"
runat
=
"server"
EnableCustomAttributeEditing
=
"true"
OnTimeSlotCreated
=
"RadScheduler1_TimeSlotCreated"
>
<
TimeSlotContextMenus
>
<
telerik:RadSchedulerContextMenu
ID
=
"SchedulerTimeSlotContextMenu"
runat
=
"server"
Skin
=
"Outlook"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
""
/>
<
telerik:RadMenuItem
IsSeparator
=
"True"
/>
<
telerik:RadMenuItem
Text
=
"New Job"
/>
<
telerik:RadMenuItem
Text
=
"New Task"
/>
<
telerik:RadMenuItem
IsSeparator
=
"True"
/>
<
telerik:RadMenuItem
Text
=
"Google Route"
/>
<
telerik:RadMenuItem
IsSeparator
=
"True"
/>
<
telerik:RadMenuItem
Text
=
"Go to today"
Value
=
"CommandGoToToday"
/>
<
telerik:RadMenuItem
Text
=
"Show 24 hours"
Value
=
"CommandShow24Hours"
/>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
<
telerik:RadSchedulerContextMenu
ID
=
"TimeSlotDidabledContectMenu"
runat
=
"server"
Skin
=
"Outlook"
Enabled
=
"false"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"item1"
/>
<
telerik:RadMenuItem
Text
=
"item2"
/>
<
telerik:RadMenuItem
Text
=
"item3"
/>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
</
TimeSlotContextMenus
>
</
telerik:RadScheduler
>
If you are using web service binding to populate RadScheduler with data then you need to handle the NavigationComplete client event so you will be able to change the context menu when the selected view changes as here no postback to the server will be made when selected view is changed.
Kind regards,
Ivana
the Telerik team