Skip to main content

ASPxSchedulerDataWebControlBase.FilterResource Event

Hides specific resources in the scheduler.

Namespace: DevExpress.Web.ASPxScheduler

Assembly: DevExpress.Web.ASPxScheduler.v24.1.dll

NuGet Package: DevExpress.Web.Scheduler

Declaration

public event PersistentObjectCancelEventHandler FilterResource

Event Data

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

Property Description
Cancel Gets or sets whether to cancel the operation.
Object Gets the persistent object (appointment, resource or appointment dependency) for which the event occurs. Inherited from PersistentObjectEventArgs.

Remarks

The FilterResource event is raised in turn for each resource in the Resources storage. If the PersistentObjectCancelEventArgs.Cancel parameter is set to true for the currently processed resource, this resource will be hidden in the scheduler. Specifically, the resource will not be displayed when appointments are grouped by resources (see the ASPxScheduler.GroupType topic).

The following code snippet illustrates handling the FilterResource event in order to hide all resources containing the name “Ryan”:

protected void ASPxScheduler1_FilterResource(object sender, PersistentObjectCancelEventArgs e) {
    if(((Resource)e.Object).Caption.Contains("Ryan")) e.Cancel = true;
}

Example

The following example illustrates how to filter resources based on the “Resources filter” combobox value. Call the Refresh method within the ASPxClientComboBox.SelectedIndexChanged event handler to refresh the ASPxScheduler’s content.

<dx:ASPxComboBox ID="ASPxComboBoxResourcesFilter" runat="server" ValueType="System.String">
    <ClientSideEvents SelectedIndexChanged="function() { clientScheduler.Refresh(); }" />
</dx:ASPxComboBox>
protected void ASPxScheduler1_FilterResource(object sender, PersistentObjectCancelEventArgs e) {
    if(ASPxComboBoxResourcesFilter.Value != null) {
        int filterValue = Convert.ToInt32(ASPxComboBoxResourcesFilter.Value);
        if(filterValue != -100) {
            e.Cancel = Convert.ToInt32((e.Object as Resource).Id) != filterValue;
        }
    }
}
See Also