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

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

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

		If Not IsPostBack Then
			DayPilotCalendar1.DataSource = getData()
			DataBind()
		End If
	End Sub

	Protected Function getData() As DataTable
		Dim dt As DataTable
		dt = New DataTable()
		dt.Columns.Add("start", GetType(Date))
		dt.Columns.Add("end", GetType(Date))
		dt.Columns.Add("name", GetType(String))
		dt.Columns.Add("id", GetType(String))

		Dim dr As DataRow

		dr = dt.NewRow()
		dr("id") = 0
		dr("start") = Convert.ToDateTime("15:50")
		dr("end") = Convert.ToDateTime("15:55")
		dr("name") = "Event 1"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 1
		dr("start") = Convert.ToDateTime("16:00")
		dr("end") = Convert.ToDateTime("17:00")
		dr("name") = "Event 2"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 2
		dr("start") = Convert.ToDateTime("16:15")
		dr("end") = Convert.ToDateTime("18:45")
		dr("name") = "Event 3"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 3
		dr("start") = Convert.ToDateTime("16:30")
		dr("end") = Convert.ToDateTime("17:30")
		dr("name") = "Sales Dept. Meeting Once Again"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 4
		dr("start") = Convert.ToDateTime("8:00")
		dr("end") = Convert.ToDateTime("9:00")
		dr("name") = "Event 4"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 5
		dr("start") = Convert.ToDateTime("22:00")
		dr("end") = Convert.ToDateTime("6:00").AddDays(1)
		dr("name") = "Event 5"
		dt.Rows.Add(dr)


		dr = dt.NewRow()
		dr("id") = 6
		dr("start") = Convert.ToDateTime("11:00")
		dr("end") = Convert.ToDateTime("13:00")
		dr("name") = "Event 6"
		dt.Rows.Add(dr)

		Return dt

	End Function
End Class
