Skip to main content

ASPxClientScheduler.MenuItemClicked Event

Client-side event that occurs when a popup menu item is clicked.

Declaration

MenuItemClicked: ASPxClientEvent<MenuItemClickedEventHandler<ASPxClientScheduler>>

Event Data

The MenuItemClicked event's data class is MenuItemClickedEventArgs. The following properties provide information specific to this event:

Property Description
handled Gets or sets whether an event is handled, and that default actions are not required.
itemName Gets the name of the menu item which is clicked.

Remarks

Use this event to implement client-side processing of item selected in the popup menu.

The following code uses the ASPxClientScheduler.MenuItemClicked event to process selected menu item on the client-side and call the corresponding script function.

<ClientSideEvents MenuItemClicked="function(s, e) { OnMenuItemClick(s,e); }"/>
function OnMenuItemClick(s, e) {
    e.handled = true;
        switch(e.itemName) {
        case SchedulerMenuItemId.NewAppointment:
            NewAppointment(scheduler);
            break;
        case SchedulerMenuItemId.NewRecurringAppointment:
            NewRecurringAppointment(scheduler);
            break;
        case SchedulerMenuItemId.NewAllDayEvent:
            NewAllDayEvent(scheduler);
            break;
        case SchedulerMenuItemId.NewRecurringEvent:
            NewRecurringEvent(scheduler);
            break;
        case SchedulerMenuItemId.OpenAppointment:
            OpenAppointment(scheduler);
            break;
        case SchedulerMenuItemId.EditSeries:
            EditSeries(scheduler);
            break;
        default:
            e.handled = false;    
    }
}

Example

The following example illustrates how to use the ASPxClientScheduler.PerformCallback method.

<Appointments AutoRetrieveId="True" ResourceSharing="false">
   <CustomFieldMappings>
       <dxwschs:ASPxAppointmentCustomFieldMapping Member="Completed" Name="LessonCompleted" ValueType="Boolean" />
       <dxwschs:ASPxAppointmentCustomFieldMapping Member="CustomIsRecurring" Name="CustomRecurringFlag" ValueType="Boolean" />
       <dxwschs:ASPxAppointmentCustomFieldMapping Member="CustomRecurringID" Name="CustomRecurringID" ValueType="String" />
       <dxwschs:ASPxAppointmentCustomFieldMapping Member="CreatedBy" Name="ApptCreatedBy" ValueType="String" />
       <dxwschs:ASPxAppointmentCustomFieldMapping Member="ModifiedBy" Name="ApptModifiedBy" ValueType="String" />
       <dxwschs:ASPxAppointmentCustomFieldMapping Member="CreatedDate" Name="ApptCreatedDate" ValueType="DateTime" />
       <dxwschs:ASPxAppointmentCustomFieldMapping Member="ModifiedDate" Name="ApptModifiedDate" ValueType="DateTime" />
    </CustomFieldMappings>
</Appointments>
protected void ASPxScheduler1_CustomCallback(object sender, CallbackEventArgsBase e) { ASPxScheduler scheduler = sender as ASPxScheduler;
    if(e.Parameter == "ChangeCompletedStatus" && scheduler.SelectedAppointments.Count > 0) {
        Appointment currentAppt = scheduler.SelectedAppointments[0];
        currentAppt.CustomFields["LessonCompleted"] = !Convert.ToBoolean(currentAppt.CustomFields["LessonCompleted"]);
    }
}
function OnMenuItemClicked(s, e) {
    if (e.itemName == "ChangeCompletedStatus") {
        clientScheduler.PerformCallback(e.itemName);
        e.handled = true;
    }
    else if (e.itemName == "GroupByDate") {
        clientScheduler.SetGroupType("Date");
    }
    else if (e.itemName == "GroupByResource") {
        clientScheduler.SetGroupType("Resource");
    }
    else if (e.itemName == "GroupByNone") {
        clientScheduler.SetGroupType("None");
    }
}
See Also