This is a migrated thread and some comments may be shown as answers.

ContextMenuID -- Does not work

3 Answers 24 Views
This is a migrated thread and some comments may be shown as answers.
Sean Overman
Top achievements
Rank 1
Sean Overman asked on 10 Nov 2009, 02:02 AM
I am attempting to use the new ContextMenuID feature with no success.  Here is a simplified version of what I'm doing.

<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 { getset; } 
    public string Description { getset; } 
    public DateTime StartTime { getset; } 
    public DateTime EndTime { getset; } 
 
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

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 12 Nov 2009, 02:47 PM
Hello Sean,

We have just recently discovered that this is a bug with RadScheduler. We will fix it for the upcoming service pack at the latest. Please, excuse us for any inconvenience caused by this bug.

Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Olivier
Top achievements
Rank 2
answered on 21 Oct 2015, 07:47 AM

Hello

 

Have you correct the bug, for the ContextMenu Custom add like this ?

it's doesn't work for me and i haven't the custom menu.

version : v2015.2.826.45

thanks

 


 

protected void RadScheduler1_AppointmentDataBound(object sender,SchedulerEventArgs e) {
           e.Appointment.ContextMenuID = "SchedulerAppointmentContextMenu2";
 
            
       }

0
Olivier
Top achievements
Rank 2
answered on 21 Oct 2015, 08:23 AM

Hello,

 I found my error, i wait on timeslot contextmenu and i use in appointment.

 

sorry , it's works 

thanks

Asked by
Sean Overman
Top achievements
Rank 1
Answers by
Peter
Telerik team
Olivier
Top achievements
Rank 2
Share this question
or