Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports DayPilot.Web.Ui.Enums

Partial Public Class Horizontal_DateSwitching
	Inherits System.Web.UI.Page

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

	End Sub
	Protected Sub DayPilotCalendar1_Refresh(ByVal sender As Object, ByVal e As DayPilot.Web.Ui.Events.RefreshEventArgs)
		DayPilotCalendar1.Days = e.Days
		If e.Days = 7 Then
			DayPilotCalendar1.StartDate = DayPilot.Utils.Week.FirstDayOfWeek(e.StartDate)
		Else
			DayPilotCalendar1.StartDate = e.StartDate
		End If

		DayPilotCalendar1.DataBind()
		DayPilotCalendar1.Update(CallBackUpdateType.Full)
	End Sub
	Protected Sub DayPilotCalendar1_Command(ByVal sender As Object, ByVal e As DayPilot.Web.Ui.Events.CommandEventArgs)
		Select Case e.Command
			Case "previous"
				DayPilotCalendar1.StartDate = DayPilotCalendar1.StartDate.AddDays(-DayPilotCalendar1.Days)
			Case "next"
				DayPilotCalendar1.StartDate = DayPilotCalendar1.StartDate.AddDays(DayPilotCalendar1.Days)
			Case "today"
				DayPilotCalendar1.StartDate = If(DayPilotCalendar1.Days = 7, DayPilot.Utils.Week.FirstDayOfWeek(Date.Today), Date.Today)
			Case "week"
				DayPilotCalendar1.Days = 7
				DayPilotCalendar1.StartDate = DayPilot.Utils.Week.FirstDayOfWeek(DayPilotCalendar1.StartDate)
			Case "day"
				DayPilotCalendar1.Days = 1
		End Select

		DayPilotCalendar1.DataBind()
		DayPilotCalendar1.Update(CallBackUpdateType.Full)
	End Sub
End Class
