search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How to change the code to display varchar and date type data instead of two datetime type for the daypilot calendar?

Asked by Jordjmax
5 years ago.

I have this table called event. I am using daypilot calendar control to display the data from the event table. Currently I am using name, name2, eventstart and eventend column field data to display in the calendar and it works. But now I would like to display BOOK_DATE, START_TIME and END_TIME column field data instead of eventstart and eventend. Because now that the START_TIME and END_TIME is using varchar instead of datetime, and because the date is now seperated into one field which is BOOK_DATE, I don't know how to change the code.

For the 3rd screenshot I am using name, name2, eventstart and eventend to display. But I would like to have the same output like the 3rd screenshot but using BOOK_DATE, START_TIME and END_TIME column field data instead. you can see from the 2nd screenshot the properties, If i replace eventstart with START_TIME and replace eventend with END_TIME. Where should I put the BOOK_DATE? I think i explained it very specific already thanks.

I posted my question at forum and it can't be solve . Over there, I posted 3 screenshots.

I also posted at video at . I followed the guy codes who is helping me at forum and it doesn't work also. But he says it worked for him. And he suggest that I post here for help.

Sorry I posted this the second time because previous one i forgot to add screenshots.


<html xmlns="">
<head runat="server">
<link rel="stylesheet" href="stylesheets/style.css" type="text/css" />
<form id="form1" runat="server">
<div style="text-align: center">

<asp:Label ID="lblVenue" runat="server"
style="font-size: xx-large; font-weight: 700" Text="Label"></asp:Label>


<DayPilot:DayPilotCalendar ID="DayPilotCalendar1" runat="server"
EventMoveHandling="CallBack" BackColor="#0066FF" BusinessBeginsHour="8"
BusinessEndsHour="19" CssOnly="False" EventBackColor="#66FF99"
HourBorderColor="Lime" HourHalfBorderColor="#0066FF"
HourNameBackColor="#6699FF" HourNameBorderColor="#0066FF" HoverColor="#0066FF"
style="top: -1px; left: 8px; margin-right: 6px;" DayEndsHour="6" HeaderDateFormat="dddd"



public partial class number2 : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
lblVenue.Text = Session["roomvalue"] != null ? Session["roomvalue"].ToString() : "";

if (!IsPostBack)
DayPilotCalendar1.StartDate = DayPilot.Utils.Week.FirstWorkingDayOfWeek(new DateTime(2014, 03, 17));
DayPilotCalendar1.DataSource = dbGetEvents(DayPilotCalendar1.StartDate, DayPilotCalendar1.Days);

private DataTable dbGetEvents(DateTime start, int days)
string constr = ConfigurationManager.ConnectionStrings["ProjectConnectionString"].ConnectionString;
SqlDataAdapter da = new SqlDataAdapter("SELECT [id], [Name] + ', ' + Name2 AS [Names], [EventStart], [EventEnd] FROM [event] WHERE NOT (([eventend] <= @start) OR ([eventstart] >= @end))", constr);
da.SelectCommand.Parameters.AddWithValue("start", start);
da.SelectCommand.Parameters.AddWithValue("end", start.AddDays(days));
DataTable dt = new DataTable();
return dt;

Answer posted by Dan Letecky [DayPilot]
5 years ago.

If you want to customize the text that is displayed in the event box you should use the BeforeEventRender event.

protected void DayPilotCalendar1_BeforeEventRender(object sender, BeforeEventRenderEventArgs e)
  e.InnerHTML = e.Text + ", starts at " + e.Start.ToString("HH:mm");

See also here (this is DayPilot Pro documentation but the mechanism is the same in the Lite edition):

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.