Chandan Kumar
Top achievements
Rank 1
Chandan Kumar
asked on 01 Apr 2010, 06:15 AM
Hi Sir,
i Want to Create Dynamic RadScheduler Context Menu.
Like In Blank Row Of Scheduler Context Menu Appear New and Disable Paste Menu.
And Where Appointment is given Then There Context Menu Appear Like Edit, Copy, Paste, Cut etc. When I Copy Any Appointment and then Again go to blank Row then Context menu appear New And Paste Option. How can Achive this type of Condition. Please Help Me.
Thanks
Chandan Kumar.
i Want to Create Dynamic RadScheduler Context Menu.
Like In Blank Row Of Scheduler Context Menu Appear New and Disable Paste Menu.
And Where Appointment is given Then There Context Menu Appear Like Edit, Copy, Paste, Cut etc. When I Copy Any Appointment and then Again go to blank Row then Context menu appear New And Paste Option. How can Achive this type of Condition. Please Help Me.
Thanks
Chandan Kumar.
8 Answers, 1 is accepted
0
Hi Chandan,
RadScheduler exposes two different types of context menus:
Appointment context menu
Time slot context menu
Additionally, you can conditionally set the ContextMenuID property to specify which context menu to open for a given appointment:
I have also attached a simple demo of using context menus to copy/cut and paste appointments.
Greetings,
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.
RadScheduler exposes two different types of context menus:
Appointment context menu
Time slot context menu
Additionally, you can conditionally set the ContextMenuID property to specify which context menu to open for a given appointment:
protected
void
RadScheduler1_AppointmentDataBound(
object
sender, SchedulerEventArgs e)
{
e.Appointment.ContextMenuID =
"SchedulerAppointmentContextMenu2"
;
}
I have also attached a simple demo of using context menus to copy/cut and paste appointments.
Greetings,
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.
0
Chandan Kumar
Top achievements
Rank 1
answered on 01 Apr 2010, 02:54 PM
Hello Sir, I Know These things and thanks, But i want to create dinamic Menu item in these two category of Rad Scheduler Contecxt menu. Or i want to enable or Disable of some menu Items in Rad Schedule Context Menu According to Some Condition. So please help me to handdle this problem.
Thanks
Chandan
Thanks
Chandan
0
Matt
Top achievements
Rank 1
answered on 15 Jul 2014, 10:49 PM
I'm also trying to figure this out. I need to be able to set the Appointment Context Menu text at runtime. Anyone?
0
Matt,
Please look at this forum post, where the same question has already been answered.
Regards,
Hristo Valyavicharski
Telerik
Please look at this forum post, where the same question has already been answered.
Regards,
Hristo Valyavicharski
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.
0
David
Top achievements
Rank 1
answered on 03 Oct 2014, 12:35 PM
@Hristo Valyavicharski,
Please look at this forum post where the OP states that the question was not answered.
Yes, at run-time you can select which of the context menus that were created in design time are to be attached to a given appointment. Check.
Matt, Chandan Kumar, and I are looking for the run-time capability to modfiy the context menu based on other criteria, such as is shown in this help topic for the TreeView control
For instance I have a table of resources that is editable by the end user. I want the context menu to allow assignment of these resources.
In pseudo code I would be looking for something like:
Is this possible?
Please look at this forum post where the OP states that the question was not answered.
Yes, at run-time you can select which of the context menus that were created in design time are to be attached to a given appointment. Check.
Matt, Chandan Kumar, and I are looking for the run-time capability to modfiy the context menu based on other criteria, such as is shown in this help topic for the TreeView control
For instance I have a table of resources that is editable by the end user. I want the context menu to allow assignment of these resources.
In pseudo code I would be looking for something like:
protected
void
RadScheduler1_AppointmentDataBound(
object
sender, SchedulerEventArgs e)
{
RadSchedulerContextMenu menu = e.Appointment.ContextMenu;
RadSchedulerContextMenuItem item = new RadSchedulerContextMenuItem("Display Text","Command Name","Command Args", hasChildren);
RadSchedulerContextMenuItem node = menu.Items.FindByText("Home");
node.Add(item);
}
Is this possible?
0
Hi David,
Try this approach:
Define two context menus and make the second invisible:
Handle the OnAppointmentCreated event:
I hope this helps.
Regards,
Hristo Valyavicharski
Telerik
Try this approach:
Define two context menus and make the second invisible:
<
telerik:RadScheduler
ID
=
"RadScheduler1"
runat
=
"server"
DataDescriptionField
=
"Description"
DataEndField
=
"End"
DataKeyField
=
"ID"
DataRecurrenceField
=
"RecurrenceRule"
DataRecurrenceParentKeyField
=
"RecurrenceParentID"
DataReminderField
=
"Reminder"
OnAppointmentDataBound
=
"RadScheduler1_AppointmentDataBound"
OnAppointmentCreated
=
"RadScheduler1_AppointmentCreated"
DataSourceID
=
"sdsAppointments"
DataStartField
=
"Start"
DataSubjectField
=
"Subject"
>
<
AppointmentContextMenus
>
<
telerik:RadSchedulerContextMenu
ID
=
"ContextMenu1"
runat
=
"server"
OnClientItemOpening
=
"OnClientItemOpening"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Copy"
>
</
telerik:RadMenuItem
>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
<
telerik:RadSchedulerContextMenu
ID
=
"ContextMenu2"
runat
=
"server"
Visible
=
"false"
>
</
telerik:RadSchedulerContextMenu
>
</
AppointmentContextMenus
>
</
telerik:RadScheduler
>
Handle the OnAppointmentCreated event:
protected
void
RadScheduler1_AppointmentCreated(
object
sender, AppointmentCreatedEventArgs e)
{
if
(e.Appointment.Subject ==
"test"
)
{
e.Appointment.ContextMenuID = ContextMenu1.ID;
}
else
{
e.Appointment.ContextMenuID = ContextMenu2.ID;
}
}
I hope this helps.
Regards,
Hristo Valyavicharski
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.
0
David
Top achievements
Rank 1
answered on 08 Oct 2014, 04:17 PM
Thank you for the response.
It appears that the scheduler doesn't have the capabilities I am looking for and I will have to work around this limitation.
Specific capabilities not included in the current version are:
- Change TimeSlot context menus at run time using a RadScheduler1_TimeSlotCreated() event similar to your post directly above. As current, the RadScheduler only allows for one TimeSlot context menu that is built in design mode.
- Add/change/update the menu items within a context menu during run time. Yes, you can create multiple different Appointment Context menus during design time and switch between them at run time. However you cannot dynamically add menu items to either an Appointment Context or TimeSlot Context menu.
For example, appointments are assigned to a worker. The context menu has "Assign to Worker" as a main item. Through the 'AppointmentCreated' event, programatically grab a list of workers and add sub-items to the context menu.
This dynamic capability exists in the RadMenu, as shown here: http://www.telerik.com/help/aspnet-ajax/menu-context-runtime.html
It appears that the scheduler doesn't have the capabilities I am looking for and I will have to work around this limitation.
Specific capabilities not included in the current version are:
- Change TimeSlot context menus at run time using a RadScheduler1_TimeSlotCreated() event similar to your post directly above. As current, the RadScheduler only allows for one TimeSlot context menu that is built in design mode.
- Add/change/update the menu items within a context menu during run time. Yes, you can create multiple different Appointment Context menus during design time and switch between them at run time. However you cannot dynamically add menu items to either an Appointment Context or TimeSlot Context menu.
For example, appointments are assigned to a worker. The context menu has "Assign to Worker" as a main item. Through the 'AppointmentCreated' event, programatically grab a list of workers and add sub-items to the context menu.
This dynamic capability exists in the RadMenu, as shown here: http://www.telerik.com/help/aspnet-ajax/menu-context-runtime.html
0
David,
This approach with adding items on the server is not suitable for this scenario. Here you want to have different context menus for every appointment. So this means you have to create separate context menu for every appointment. This is not recommended. Or if you have one menu it is not possible to change its items on the server because when the page is loaded all Scheduler's appointments will created. This what you could do is to add new menu items on the client. For example create one context menu and dynamically add/remove items in the OnClientAppointmentContextMenu event:
Regards,
Hristo Valyavicharski
Telerik
This approach with adding items on the server is not suitable for this scenario. Here you want to have different context menus for every appointment. So this means you have to create separate context menu for every appointment. This is not recommended. Or if you have one menu it is not possible to change its items on the server because when the page is loaded all Scheduler's appointments will created. This what you could do is to add new menu items on the client. For example create one context menu and dynamically add/remove items in the OnClientAppointmentContextMenu event:
<
telerik:RadScheduler
ID
=
"RadScheduler1"
runat
=
"server"
DataDescriptionField
=
"Description"
DataEndField
=
"End"
DataKeyField
=
"ID"
DataRecurrenceField
=
"RecurrenceRule"
DataRecurrenceParentKeyField
=
"RecurrenceParentID"
OnClientAppointmentContextMenu
=
"OnClientAppointmentContextMenu"
DataReminderField
=
"Reminder"
OnAppointmentDataBound
=
"RadScheduler1_AppointmentDataBound"
OnAppointmentCreated
=
"RadScheduler1_AppointmentCreated"
DataSourceID
=
"sdsAppointments"
DataStartField
=
"Start"
DataSubjectField
=
"Subject"
>
<
AppointmentContextMenus
>
<
telerik:RadSchedulerContextMenu
ID
=
"ContextMenu1"
runat
=
"server"
OnClientItemOpening
=
"OnClientItemOpening"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Copy"
>
</
telerik:RadMenuItem
>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
</
AppointmentContextMenus
>
</
telerik:RadScheduler
>
<script>
var
menu;
function
pageLoad() {
menu = $find(
"<%= ContextMenu1.ClientID %>"
);
}
function
OnClientAppointmentContextMenu(sender, args) {
var
rootItem =
new
Telerik.Web.UI.RadMenuItem();
rootItem.set_text(
"New Root Item"
);
menu.get_items().add(rootItem);
}
</script>
Regards,
Hristo Valyavicharski
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.