Is there any way when using the update panel version of this awesome tool to make the DayPilot get the data from a SQL Data Source instead of the data provided in the code behind?
Here is a snippet of the code found in the downlaoded version of DayPilot Lite.
protected void Page_Load(object sEnder, EventArgs e)
{
if (!IsPostBack)
{
Calendar1.SelectedDate = DateTime.Today;
setWeek();
DayPilotCalendar2.DataSource = getData();
DataBind();
}
}
protected DataTable getData()
{
DataTable dt;
dt = new DataTable();
dt.Columns.Add("CourseID", typeof(string));
dt.Columns.Add("Start", typeof(DateTime));
dt.Columns.Add("End", typeof(DateTime));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("ID", typeof(string));
DataRow dr;
dr = dt.NewRow();
dr["ID"] = 0;
dr["CourseID"] = 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["CourseID"] = 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["CourseID"] = 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["CourseID"] = 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["CourseID"] = 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["CourseID"] = 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["CourseID"] = 6;
dr["Start"] = Convert.ToDateTime("11:00");
dr["End"] = Convert.ToDateTime("13:00");
dr["Name"] = "Event 6";
dt.Rows.Add(dr);
return dt;
}
Id like to alter this scenario to use data from my SQL Data Source but don't know how.
Many thanks indeed.