Limit ScheduleView to a date range

3 posts, 0 answers
  1. Stuart Cotts
    Stuart Cotts avatar
    18 posts
    Member since:
    Mar 2010

    Posted 15 Mar 2013 Link to this post

    I'm probably just missing this somewhere.

    I would like ScheduleView to stay within a range of dates, not allow the user to view dates before a given date or after a given date, I.E. not allow a week view to go before 3/10/2013 or after 3/24/2013.

    What would be the easiest way to accomplish this?

  2. Neelima
    Neelima avatar
    2 posts
    Member since:
    Nov 2012

    Posted 15 Mar 2013 Link to this post

    Sorry to piggy back on this.

    I need the same functionality.
  3. Yana
    Yana avatar
    5013 posts

    Posted 21 Mar 2013 Link to this post

    Hello there,

    RadScheduleView does not provide a built-in functionality for setting min and max dates. However, you could subscribe to VisibleRangeChanged event and set the CurrentDate if the new range is out of the predefined min and max dates. Here is a sample code snippet:

    private void ScheduleView_VisibleRangeChanged(object sender, EventArgs e)
        var minDate = new DateTime(2013,3,10,0,0,0);
        var maxDate = new DateTime(2013,4,10, 0, 0,0);
        var scheduleView = sender as RadScheduleView;
        var visibleRange = scheduleView.VisibleRange;
        if (visibleRange.Start < minDate)
            scheduleView.CurrentDate = minDate;            
        else if (visibleRange.End > maxDate)
            scheduleView.CurrentDate = maxDate;

    I hope this helps.

    Kind regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top