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

AppointmentContetMenus - Submenus programmatically?

2 Answers 91 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 17 Oct 2011, 01:22 PM
Hi!

I can add AppointmentContextMenus rows programmatically like this:

foreach (Resource resourceUser in RadScheduler1.Resources.GetResourcesByType("Employee"))
{
    string availEmployee = resourceUser.Text;
    RadMenuItem resourceItem = new RadMenuItem(availEmployee);
    resourceItem.Attributes["Key"] = resourceUser.Key.ToString();
    resourceItem.Value = "CommandAddAppointment";
    resourceItem.ImageUrl = "/i/Toolbar/Custom/personal.png";
    RadScheduler1.AppointmentContextMenus[0].Items.Add(resourceItem);
}

How can I put them into a submenu?
See my attached picture (a screen dump from Telerik Context Menu Demo), I want my list of employees to end up inside the "Categorize" menurow.

I'm using v.2011.2.915.40

Sincerely, Thomas

2 Answers, 1 is accepted

Sort by
0
Accepted
Ivana
Telerik team
answered on 19 Oct 2011, 02:38 PM
Hello Thomas,

You could define the AppointmentContextMenu of RadSheduler as follows:
<AppointmentContextMenus>
    <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerAppointmentContextMenu">
        <Items>
            <telerik:RadMenuItem Text="Open" Value="CommandEdit" />
            <telerik:RadMenuItem IsSeparator="True" />
            <telerik:RadMenuItem Text="Categorize">
            </telerik:RadMenuItem>
            <telerik:RadMenuItem IsSeparator="True" />
            <telerik:RadMenuItem Text="Delete" Value="CommandDelete" />
        </Items>
    </telerik:RadSchedulerContextMenu>
</AppointmentContextMenus>

When you have the AppointmentContextMenu defined you could access its items and sub items as the highlighted code line bellow shows:
foreach (Resource resourceUser in RadScheduler1.Resources.GetResourcesByType("Employee"))
{
    string availEmployee = resourceUser.Text;
    RadMenuItem resourceItem = new RadMenuItem(availEmployee);
    resourceItem.Attributes["Key"] = resourceUser.Key.ToString();
    resourceItem.Value = "CommandAddAppointment";
    resourceItem.ImageUrl = "/i/Toolbar/Custom/personal.png";
    RadMenuItemCollection categorizeItems =  
         RadScheduler1.AppointmentContextMenus[0].Items[2].Items;
    categorizeItems.Add(resourceItem);
}

More information of defining ContextMenus could be found at the following demo page at our website:
RadScheduler: Context Menu.

Hope this helps.

Greetings,
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
Thomas
Top achievements
Rank 1
answered on 20 Oct 2011, 11:24 AM
Thank You!
It works great.

Sincerely, Thomas
Tags
Scheduler
Asked by
Thomas
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Thomas
Top achievements
Rank 1
Share this question
or