Hi!
Can someone show me an example how to accomplish the following in RadScheduler?
The user selects the desired time slots with the mouse pointer and then right click to bring up a TimeSlotContextMenu designed something like this:
Then when the user choose one of the menu items a booking should be done without poping up a booking form.
Can someone show me an example how to accomplish the following in RadScheduler?
The user selects the desired time slots with the mouse pointer and then right click to bring up a TimeSlotContextMenu designed something like this:
<
TimeSlotContextMenus
>
<
telerik:RadSchedulerContextMenu
ID
=
"SchedulerTimeSlotContextMenu"
runat
=
"server"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Peter"
/>
<
telerik:RadMenuItem
Text
=
"Adam"
/>
<
telerik:RadMenuItem
Text
=
"Niclas"
/>
<
telerik:RadMenuItem
Text
=
"Jones"
/>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
</
TimeSlotContextMenus
>
Then when the user choose one of the menu items a booking should be done without poping up a booking form.
Is it possible? If so, how do I do it?
I'm using C# and the Rad v2010.3.1317.40.
Sincerely, Thomas
6 Answers, 1 is accepted
0
Hello Thomas,
Here is one possible solution:
Regards,
Peter
the Telerik team
Here is one possible solution:
<
telerik:RadScheduler
runat
=
"server"
ID
=
"RadScheduler1"
OnTimeSlotContextMenuItemClicked
=
"RadScheduler1_TimeSlotContextMenuItemClicked"
OnFormCreating
=
"RadScheduler1_FormCreating"
>
<
TimeSlotContextMenus
>
<
telerik:RadSchedulerContextMenu
ID
=
"SchedulerTimeSlotContextMenu"
runat
=
"server"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Peter"
Value
=
"CommandAddAppointment"
/>
<
telerik:RadMenuItem
Text
=
"Adam"
Value
=
"CommandAddAppointment"
/>
<
telerik:RadMenuItem
Text
=
"Niclas"
Value
=
"CommandAddAppointment"
/>
<
telerik:RadMenuItem
Text
=
"Jones"
Value
=
"CommandAddAppointment"
/>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
</
TimeSlotContextMenus
>
</
telerik:RadScheduler
>
protected
Appointment CurrentAppointment
{
get
{
return
Session[
"CurrentAppointment"
]
as
Appointment;
}
set
{
Session[
"CurrentAppointment"
] = value;
}
}
protected
void
RadScheduler1_TimeSlotContextMenuItemClicked(
object
sender, TimeSlotContextMenuItemClickedEventArgs e)
{
CurrentAppointment.Subject = e.MenuItem.Text;
RadScheduler1.InsertAppointment(CurrentAppointment);
RadScheduler1.Rebind();
}
protected
void
RadScheduler1_FormCreating(
object
sender, SchedulerFormCreatingEventArgs e)
{
if
(e.Mode == SchedulerFormMode.Insert)
CurrentAppointment = e.Appointment;
e.Cancel =
true
;
}
Regards,
Peter
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0

Thomas
Top achievements
Rank 1
answered on 11 Mar 2011, 02:32 PM
Peter,
I must say the support at Telerik is worldclass.
Thank you very much, this works great!
I must say the support at Telerik is worldclass.
Thank you very much, this works great!
Can you also point me in the right direction on how to modify your code so...
Instead of just setting the "Subject" at the appointment to the Text Value from the RadMenuItem I also would like it to insert the UserID and RoomID into the database as well (I have two SQL database tables for that).
Another Question:
How can I from code behind add more RadMenuItem in the RadSchedulerContextMenu?
I want to fetch the userlist from de database at pageload and then create the RadMenu.
Sincerely, Thomas
0
Accepted
Thank you for the nice words, Thomas!
Attached is a simple demo of the required functionality. Please, test it and let me know if you have further questions.
All the best,
Peter
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0

Thomas
Top achievements
Rank 1
answered on 12 Mar 2011, 04:36 PM
Peter,
You are the man!
Thank you very much, it works perfect!
SIncerely, Thomas
You are the man!
Thank you very much, it works perfect!
SIncerely, Thomas
0

Thomas
Top achievements
Rank 1
answered on 14 Mar 2011, 02:22 AM
What am I missing here?
The following code works perfect when browsing around my appointments:
But as soon I add a new appointment(with the ContextMenu one click routine) it just give me the "Object reference not set to an instance of an object."(Line 65):
If i then reload the Scheduler Page the new appointment shows upp and the css works correct.
SIncerely, Thomas
The following code works perfect when browsing around my appointments:
protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
{
string css_text = e.Appointment.Resources.GetResourceByType("CssId").Text;
if (css_text == "1")
{
e.Appointment.CssClass = "rsCategoryDarkRed";
}
else if (css_text == "2")
{
e.Appointment.CssClass = "rsCategoryBlue";
}
else if (css_text == "3")
{
e.Appointment.CssClass = "rsCategoryGreen";
}
else if (css_text == "4")
{
e.Appointment.CssClass = "rsCategoryViolet";
}
}
But as soon I add a new appointment(with the ContextMenu one click routine) it just give me the "Object reference not set to an instance of an object."(Line 65):
Line 63: protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
Line 64: {
Line 65: string css_text = e.Appointment.Resources.GetResourceByType("CssId").Text;
Line 66: if (css_text == "1")
Line 67: {
If i then reload the Scheduler Page the new appointment shows upp and the css works correct.
SIncerely, Thomas
0
Hello Thomas,
I cant replicate this problem using the demo I sent you in the previous post. Can you modify the sample so that the problem occurs and tell us exactly what changes you have made?
Greetings,
Peter
the Telerik team
I cant replicate this problem using the demo I sent you in the previous post. Can you modify the sample so that the problem occurs and tell us exactly what changes you have made?
Greetings,
Peter
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!