Custom VisibleRange

5 posts, 0 answers
  1. samin
    samin avatar
    27 posts
    Member since:
    Feb 2011

    Posted 14 May 2011 Link to this post

    Hi I want to a custom range of date show in MonthView Mode.....How can I set visibleRange From Date1 to Date2?

    thanks.
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 16 May 2011 Link to this post

    Hi samin,

    I suggest you set CurrentDate property of the RadScheduleView control - in MonthView mode the corresponding Month will be displayed. Also VisibleDays property of the MonthViewDefinition can be used to show more than one month:

    <telerik:RadScheduleView.ViewDefinitions>
        <telerik:MonthViewDefinition VisibleDays="50" />
    </telerik:RadScheduleView.ViewDefinitions>

    Hope this helps.

    Kind regards,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 12 Oct 2011 Link to this post

    Hi,

    In the MonthView I want to set current week as the first week in the view, then I want to display six weeks.
    This is because we use the calendar as a scheduling tool, and we are not interested in passed days.

    But setting the CurrentDate always display the whole month, is there anyway to explicitly set the first date?

    - Regards,
    Håkan
  5. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 13 Oct 2011 Link to this post

    Hello Håkan,

    You need to create a new ViewDefinition, that derives from MonthViewDefinition and override its GetVisibleRangeStart method. For example the following view definition will display MonthView that starts from the first day of the week that contains the current date:

    public class CustomMonthViewDefinition : MonthViewDefinition
    {
        protected override DateTime GetVisibleRangeStart(DateTime currentDate, CultureInfo culture, DayOfWeek? firstDayOfWeek) 
        {
            return CalendarHelper.GetFirstDayOfWeek(currentDate, firstDayOfWeek.Value);
        }
    }

    Then you could use it like this:
    <telerik:RadScheduleView>
        <telerik:RadScheduleView.ViewDefinitions>
            <local:CustomMonthViewDefinition VisibleDays="42" />
        </telerik:RadScheduleView.ViewDefinitions>
    </telerik:RadScheduleView>

    where 42 comes from the range you requested - 6 weeks * 7 days = 42 days.

    Regards,
    Valeri Hristov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 13 Oct 2011 Link to this post

    That worked fine, thank you!

    Regards,
    Håkan
Back to Top
DevCraft banner