This question is locked. New answers and comments are not allowed.
Hi Telerik,
I was hoping that these two properties (DisplayDateStart and DisplayDateEnd) would give me the date range that is visible on the calendar but in my case they are both empty.
Is this a bug?
I was hoping that these two properties (DisplayDateStart and DisplayDateEnd) would give me the date range that is visible on the calendar but in my case they are both empty.
Is this a bug?
4 Answers, 1 is accepted
0
Hello Paul,
Thank you for writing.
This is the expected behavior for these properties. They should be used to specify a range for the dates that the user can view. On the other hand, the properties SelectableDateStart and SelectableDateEnd specify the dates that the user can select.
If, however, you want the dates that are visible currently in the calendar, you can use the property DisplayDate. It is of type DateTime and would give you the first date of the month that is currently visible on the calendar.
Kind regards,
Todor
the Telerik team
Thank you for writing.
This is the expected behavior for these properties. They should be used to specify a range for the dates that the user can view. On the other hand, the properties SelectableDateStart and SelectableDateEnd specify the dates that the user can select.
If, however, you want the dates that are visible currently in the calendar, you can use the property DisplayDate. It is of type DateTime and would give you the first date of the month that is currently visible on the calendar.
Kind regards,
Todor
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
paul
Top achievements
Rank 1
answered on 10 Jan 2012, 12:55 PM
Hi Todor
I am aware of display date giving me the first date of the month but it doesn't tell me the full range of dates displayed on the calendar.
For example, if i look at Feb 2012 i see the dates 29/01 to 10/03 - these are the dates i need to access.
I am aware of display date giving me the first date of the month but it doesn't tell me the full range of dates displayed on the calendar.
For example, if i look at Feb 2012 i see the dates 29/01 to 10/03 - these are the dates i need to access.
0
Hi Paul,
RadCalendar currently does not expose properties which provide the dates that you need to display in your scenario. However, you can write some code and find those dates. Here is one way to do it:
I hope this helps. If you need more assistance, don't hesitate to write us again.
Kind regards,
Todor
the Telerik team
RadCalendar currently does not expose properties which provide the dates that you need to display in your scenario. However, you can write some code and find those dates. Here is one way to do it:
const int TotalNumberOfDaysInCalendar = 42;
DayOfWeek? firstDayOfWeek = this.radCalendar.FirstDayOfWeek;
if (firstDayOfWeek == null)
{
if (radCalendar.Culture != null)
{
firstDayOfWeek = this.radCalendar.Culture.DateTimeFormat.FirstDayOfWeek;
}
else
{
firstDayOfWeek = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek;
}
}
DateTime firstDayInMonth = new DateTime(this.radCalendar.DisplayDate.Year, this.radCalendar.DisplayDate.Month, 1);
int daysToSubtract = (int)firstDayInMonth.DayOfWeek - (int)firstDayOfWeek;
if (daysToSubtract < 0)
{
daysToSubtract += 7;
}
DateTime firstDayToDisplay = firstDayInMonth.AddDays(-daysToSubtract);
DateTime lastDayToDisplay = firstDayToDisplay.AddDays(TotalNumberOfDaysInCalendar - 1);
I hope this helps. If you need more assistance, don't hesitate to write us again.
Kind regards,
Todor
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
paul
Top achievements
Rank 1
answered on 10 Jan 2012, 04:40 PM
Perfect - Thank you