In my DayPilot Calendar (Lite) it currently on shows data from one column from the database, which is set to the DataTextField. How do I add more data to each event so the user can look at more data from the database for each event?
I currently have this set as a property for my calendar:
OnBeforeEventRender="DayPilotCalendar1_BeforeEventRender"
In the code behind (C#), I have this function to see how it works.
protected void DayPilotCalendar1_BeforeEventRender(Object sender, BeforeEventRenderEventArgs e)
{
e.Html += "Test String";
}
This just adds the string behind the pulled data from DB.
So what my calendar shows is this:
DataTextField="eventTitle"
The name of the event is what's show in the calendar. What I want is for the calendar to show is not only the event name, but the location, time, name of person who arranged the event, which are all pulled from the database.
My select sql statement already has all these data selected, but how do I add more to the text field with this data?
How can I achieve this?
You can access the datasource item using e.DataItem property:
protected void DayPilotCalendar1_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.Calendar.BeforeEventRenderEventArgs e)
{
if (e.DataItem.Source != null)
{
string location = e.DataItem["location"] as string;
string person = e.DataItem["person"] as string;
e.Html = e.Text + ", location: " + location + ", person: " + person;
}
}
A few notes: