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

Custom content in scheduler event DayPilotBubble

Asked by Andy Woodward
10 years ago.

Hi,

How do I add custom content to the daypilotbubble for an event in scheduler.
I can add the common fields such as e.text, e.start, e.end etc.

How do I add e.DataItem["Location"] for example.

"Location" is a field in the event table in the database

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

There are two options:

1. You can define the bubble HTML in BeforeEventRender event handler. This will store the bubble HTML with the event (it will be static). No server-side call will be required when opening the bubble. In BeforeEventRender you can access e.DataItem. e.DataItem holds all fields from the original object, accessible using the indexer - e.g. e.DataItem["Location"]. The original object is stored in e.DataItem.Source.

See also:
http://doc.daypilot.org/scheduler/event-customization/

2. You can load the bubble HTML dynamically using DayPilotBubble.RenderEventBubble. This event handler will be called if the static HTML is not defined. You can't access e.DataItem here but you can access custom fields specified using DayPilotScheduler.DataTagFields.

Example:

Scheduler
DayPilotScheduler1.DataTagFields="Location";  // must be 
Bubble
protected void DayPilotBubble1_RenderEventBubble(object sender, RenderEventBubbleEventArgs e)
{
  e.InnerHTML = e.Tag["Location"];
}

For more about event bubbles see:
http://doc.daypilot.org/scheduler/event-bubble/

Comment posted by Andy Woodward
10 years ago.

Thank you that works great.

Can you have multiple DataTagFields?
If so how do you define them.

I tried to add another DataTagField as follows

DayPilotScheduler1.DataTagFields = "Location";
DayPilotScheduler1.DataTagFields = "Description";

But get the error
'Specified argument was out of the range of valid values. No field with the name "Location"

Comment posted by Dan Letecky [DayPilot]
10 years ago.

Yes, you can define multiple data fields. Use a comma-separated list:

DayPilotScheduler1.DataTagFields = "Location, Description"; 
Comment posted by Andy Woodward
10 years ago.

Thank you

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