I am attempting to use the new ContextMenuID feature with no success. Here is a simplified version of what I'm doing.
There are a couple of things that don't work here.
#1 All appointments are using "AppointmentMenu1" as their context menu.
#2 By setting the ContextMenuID equal to empty string, I am still getting a context menu on appointment 3. (if this is by design, how can I accomplish this?)
Thanks,
Sean
<tel:RadScheduler ID="RadScheduler1" runat="server"> |
<TimeSlotContextMenus> |
<tel:RadSchedulerContextMenu ID="TimeSlotMenu" runat="server" > |
<Items> |
<tel:RadMenuItem Text="Menu Item 1" Value="1" /> |
</Items> |
</tel:RadSchedulerContextMenu> |
</TimeSlotContextMenus> |
<AppointmentContextMenus> |
<tel:RadSchedulerContextMenu ID="AppointmentMenu1" runat="server" > |
<Items> |
<tel:RadMenuItem Text="Menu Item 2" Value="2" /> |
</Items> |
</tel:RadSchedulerContextMenu> |
<tel:RadSchedulerContextMenu ID="AppointmentMenu2" runat="server" > |
<Items> |
<tel:RadMenuItem Text="Menu Item 3" Value="3" /> |
</Items> |
</tel:RadSchedulerContextMenu> |
</AppointmentContextMenus> |
</tel:RadScheduler> |
public class TestApt { |
public int ID { get; set; } |
public string Description { get; set; } |
public DateTime StartTime { get; set; } |
public DateTime EndTime { get; set; } |
} |
protected void Page_Init(object sender, EventArgs e) { |
RadScheduler1.DataKeyField = "ID"; |
RadScheduler1.DataSubjectField = "Description"; |
RadScheduler1.DataStartField = "StartTime"; |
RadScheduler1.DataEndField = "EndTime"; |
RadScheduler1.AppointmentDataBound += new AppointmentDataBoundEventHandler(RadScheduler1_AppointmentDataBound); |
} |
void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e) { |
if ((int)e.Appointment.ID == 1) { |
e.Appointment.ContextMenuID = "AppointmentMenu1"; |
} else if ((int)e.Appointment.ID == 2) { |
e.Appointment.ContextMenuID = "AppointmentMenu2"; |
} else { |
e.Appointment.ContextMenuID = ""; |
} |
} |
protected void Page_Load(object sender, EventArgs e) { |
if (!Page.IsPostBack) { |
List<TestApt> apts = new List<TestApt>(); |
apts.Add(new TestApt { ID = 1, Description = "Test1", StartTime = new DateTime(2009, 11, 9, 10, 0, 0), EndTime = new DateTime(2009, 11, 9, 11, 0, 0) }); |
apts.Add(new TestApt { ID = 2, Description = "Test2", StartTime = new DateTime(2009, 11, 9, 11, 0, 0), EndTime = new DateTime(2009, 11, 9, 12, 0, 0) }); |
apts.Add(new TestApt { ID = 3, Description = "Test3", StartTime = new DateTime(2009, 11, 9, 12, 0, 0), EndTime = new DateTime(2009, 11, 9, 13, 0, 0) }); |
RadScheduler1.DataSource = apts; |
RadScheduler1.DataBind(); |
} |
} |
There are a couple of things that don't work here.
#1 All appointments are using "AppointmentMenu1" as their context menu.
#2 By setting the ContextMenuID equal to empty string, I am still getting a context menu on appointment 3. (if this is by design, how can I accomplish this?)
Thanks,
Sean