DayPilot Forums

DayPilot is the best open-source Outlook-like calendar control for ASP.NET.
DayPilot Pro Demo (Calendar control)
» DayPilot Pro live demo (Calendar control)
DayPilot Pro Demo (Scheduler control)
» DayPilot Pro live demo (Scheduler control)
Home » How To » DayPilotMonth get visible start and end date

DayPilotMonth get visible start and end date

Is there any way to get the visible start and end date of the DayPilotMonth control?
Anonymous - 3/31/2008 10:42:23 PM
It's not available directly but you can calculate it the following way:

On the server-side:
// assuming that StartDate is day 1 of the given month
DateTime startDate = DayPilot.Utils.FirstDayOfWeek(DayPilotMonth1.StartDate);
DateTime endDate = DayPilot.Utils.FirstDayOfWeek(DayPilotMonth1.StartDate.AddMonths(1).AddDays(-1)).AddDays(6);
On the client side:
// "dpm" is the value of ClientObjectName
var startDate = dpm.startDate;
var endDate = DayPilot.Date.addDays(startDate, dpm.rows.length * 7 - 1);
I will make the results accessible using special properties/methods in the next release.
Dan Letecky - 4/1/2008 10:09:15 AM
Post reply