Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Goto Today (Read 2139 times)
JayCub
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Sep 8th, 2010
Goto Today
Sep 20th, 2010 at 6:20pm
Print Post  
I would like to add a button that would allow the user to go to today. Like MS Outlook.

With CurrentView= TimeTable, WeekRange, SingleMonth or MonthRange.

How can i do this?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Goto Today
Reply #1 - Sep 21st, 2010 at 6:55am
Print Post  
The displayed dates in different views are specified differently. For all day views (SingleMonth, MonthRange, List and WeekRange) the displayed interval is specified through the Calendar.Date and Calendar.EndDate properties. For the Timetable view, the displayed dates are supplied through the Calendar.TimetableSettings.Dates collection. An example of how to go to today is illustrated below:

Code
Select All
private void GoToToday()
{
      if (calendar.CurrentView == CalendarView.SingleMonth ||
            calendar.CurrentView == CalendarView.MonthRange ||
            calendar.CurrentView == CalendarView.WeekRange)
      {
            TimeSpan length = calendar.EndDate - calendar.Date;
            calendar.Date = DateTime.Today;
            calendar.EndDate = calendar.Date + length;
      }
      else if (calendar.CurrentView == CalendarView.Timetable)
      {
            calendar.TimetableSettings.Dates.Clear();
            calendar.TimetableSettings.Dates.Add(DateTime.Today);
      }
} 


Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint