Prava kafle
Top achievements
Rank 1
Prava kafle
asked on 17 Sep 2012, 11:22 PM
Hi,
I would like to show/hide context menu items based on some properties of the appointment. Context menu items are added from server side code. I am using javascipt and webservice to do this. When I call the client side script "CheckTimerStatus" , it overrides the built in JS fxn that toggles the contextmenu. How can I make both codes execute without affecting each other.
I am calling OnClientAppointmentContextMenu="CheckTimerStatus"
function CheckTimerStatus (sender, eventargs){
// hide/display contextmenuitems
}
protected void rsTicketsSchedule_DataBound(object sender, EventArgs e)
{
//AddMenuItemsToConetxtMenu
........... Logic to add context menu based on some properties....
}
Thanks,
Prava
I would like to show/hide context menu items based on some properties of the appointment. Context menu items are added from server side code. I am using javascipt and webservice to do this. When I call the client side script "CheckTimerStatus" , it overrides the built in JS fxn that toggles the contextmenu. How can I make both codes execute without affecting each other.
I am calling OnClientAppointmentContextMenu="CheckTimerStatus"
function CheckTimerStatus (sender, eventargs){
// hide/display contextmenuitems
}
protected void rsTicketsSchedule_DataBound(object sender, EventArgs e)
{
//AddMenuItemsToConetxtMenu
........... Logic to add context menu based on some properties....
}
Thanks,
Prava
6 Answers, 1 is accepted
0
Accepted
Hi Prava,
You could try the following approach:
I hope this will help!
Regards,
Ivana
the Telerik team
You could try the following approach:
function
appointmentContextMenu(sender, args) {
var
date =
new
Date();
if
(args.get_appointment().get_start() < date) {
sender.get_appointmentContextMenus()[0].get_items().getItem(3).hide();
}
else
{
sender.get_appointmentContextMenus()[0].get_items().getItem(3).show();
}
}
function
timeSlotContextMenu(sender, args) {
var
date =
new
Date();
if
(args.get_targetSlot().get_startTime() < date) {
sender.get_timeSlotContextMenus()[0].get_items().getItem(3).hide();
}
else
{
sender.get_timeSlotContextMenus()[0].get_items().getItem(3).show();
}
}
<
telerik:RadScheduler
ID
=
"RadScheduler1"
runat
=
"server"
OnClientAppointmentsPopulating
=
"OnClientAppointmentsPopulating"
SelectedView
=
"WeekView"
OnClientAppointmentContextMenu
=
"appointmentContextMenu"
OnClientTimeSlotContextMenu
=
"timeSlotContextMenu"
>
<
WebServiceSettings
Path
=
"SchedulerWebService.asmx"
ResourcePopulationMode
=
"ServerSide"
/>
<
TimeSlotContextMenus
>
<
telerik:RadSchedulerContextMenu
ID
=
"TimeSlotTSContextMenu1"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"item1"
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Text
=
"item2"
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Text
=
"item3"
>
</
telerik:RadMenuItem
>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
</
TimeSlotContextMenus
>
<
AppointmentContextMenus
>
<
telerik:RadSchedulerContextMenu
ID
=
"RadSchedulerAppContextMenu1"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"item1"
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Text
=
"item2"
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Text
=
"item3"
>
</
telerik:RadMenuItem
>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
</
AppointmentContextMenus
>
</
telerik:RadScheduler
>
I hope this will help!
Regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Prava kafle
Top achievements
Rank 1
answered on 19 Sep 2012, 03:13 AM
Hi Ivana,
Thank you very much for your quick response. In the given solution, you are hiding menu items by Index, is it possible to get item by text and then hide/display it?
Prava
Thank you very much for your quick response. In the given solution, you are hiding menu items by Index, is it possible to get item by text and then hide/display it?
Prava
0
Prava kafle
Top achievements
Rank 1
answered on 19 Sep 2012, 01:46 PM
Hi,
I had multiple context menus in an appointment, and to solve the issue I had to call hide/show function for each menu.
Thanks for helping.
Prava
I had multiple context menus in an appointment, and to solve the issue I had to call hide/show function for each menu.
Thanks for helping.
Prava
0
Hi Prava,
Thanks for sharing your solution with us. I hope it will be helpful for the community if someone encounters the same issue.
Regards,
Ivana
the Telerik team
Thanks for sharing your solution with us. I hope it will be helpful for the community if someone encounters the same issue.
Regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
DENTAL NETWORK
Top achievements
Rank 1
answered on 13 Feb 2015, 08:11 PM
Hi , I'm trying to hide the context menu in the OnClientAppointmentContextMenu event , but i don't find the way to get that. I have found only the way of hide the menu items and disabled the context menu . If you know how hide and show the context menu , por favor share with me .
Thanks in advanced
Thanks in advanced
0
Hello,
My colleague already explained how to achieve such functionality in Hide the context menu in OnClientAppointmentContextMenu forum thread.
Regards,
Boyan Dimitrov
Telerik
My colleague already explained how to achieve such functionality in Hide the context menu in OnClientAppointmentContextMenu forum thread.
Regards,
Boyan Dimitrov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.