Skip to main content

ASPxScheduler.DateNavigatorQueryActiveViewType Event

Enables you to specify a view type to which the Scheduler switches after the end-user changes selected dates in the DateNavigator control.

Namespace: DevExpress.Web.ASPxScheduler

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

Declaration

public event DateNavigatorQueryActiveViewTypeHandler DateNavigatorQueryActiveViewType

Event Data

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

Property Description
NewViewType Gets or sets the type of the view to be used by the scheduler to show its data after the date range selected in the bound DateNavigator has been changed.
OldViewType Gets the type of the view used by the scheduler to show its data before the date range selected in the bound DateNavigator is changed.
SelectedDays Gets the collection of dates selected in the DateNavigator bound to scheduler.

Remarks

The DateNavigatorQueryActiveViewType event fires when the end-user finishes selecting dates in the ASPxDateNavigator control.

You can analyze dates selected in the Date Navigator. These dates are available via the DateNavigatorQueryActiveViewTypeEventArgs.SelectedDays. Then, you can decide whether to change the view of the Scheduler or not. The former view type is available via the DateNavigatorQueryActiveViewTypeEventArgs.OldViewType property. The DateNavigatorQueryActiveViewTypeEventArgs.NewViewType property contains the view type proposed by the Date Navigator. You can leave it as it is or change as your needs dictate.

The following code prohibits changing the view by selecting dates in the Date Navigator, except when the only date selected is the current date.

private void ASPxScheduler1_DateNavigatorQueryActiveViewType(object sender, DateNavigatorQueryActiveViewTypeEventArgs e)
{
    if (e.SelectedDays.Contains(new TimeInterval(DateTime.Now, DateTime.Now.AddHours(1))))
        e.NewViewType = SchedulerViewType.Day;
    else
        e.NewViewType = e.OldViewType;
}
See Also