This is a migrated thread and some comments may be shown as answers.

Custom VisibleRange

4 Answers 115 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
samin
Top achievements
Rank 1
samin asked on 14 May 2011, 12:57 PM
Hi I want to a custom range of date show in MonthView Mode.....How can I set visibleRange From Date1 to Date2?

thanks.

4 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 16 May 2011, 08:22 AM
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
0
Håkan
Top achievements
Rank 1
answered on 12 Oct 2011, 12:34 PM
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
0
Valeri Hristov
Telerik team
answered on 13 Oct 2011, 09:42 AM
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 >>

0
Håkan
Top achievements
Rank 1
answered on 13 Oct 2011, 10:22 AM
That worked fine, thank you!

Regards,
Håkan
Tags
ScheduleView
Asked by
samin
Top achievements
Rank 1
Answers by
Yana
Telerik team
Håkan
Top achievements
Rank 1
Valeri Hristov
Telerik team
Share this question
or