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

Event Text Color on Export

Asked by C Parcell
5 years ago.

I am finding no way to change the text color or specific events when exporting.

During onBeforeEventRender we are able to change the background color of each event. In the same process there is no hook to change the text color of the event. We have attempted to wrap the text with a DIV or SPAN and styling them but the HTML code is rendered rather than being evaluated. We have attempted to utilize both InnerHtml and Html properties of e within the event, both with incorrect results.

I assume this is a bug. Is there a work around? Is this already in your bug tracker? When might this be resolved?

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

On the client side, you should be able to change the font color using args.fontColor:

dp.onBeforeEventRender = function(args) {
  args.fontColor = "red";
};

See also:
https://api.daypilot.org/daypilot-scheduler-onbeforeeventrender/

You can also customize it for export only using onBeforeEventExport:
https://api.daypilot.org/daypilot-scheduler-onbeforeeventexport/

The server-side export supports custom event text color as well (ea.FontColor).

Let me know if it doesn't work as expected.

Comment posted by C Parcell
5 years ago.

Both the links you provided are for JavaScript, not for ASP.NET.

I should have specified that we are using DayPilot Month. There is no onBeforeEventExport that I can find. We are using the WebForms DayPilotMonth object. The onBeforeEventRender has two parameters sender and e. e in this case is the event render args (I would have assumed similar to the JS documentation you linked to). The documentation that I am looking at for onBeforeEventRender is the following:

http://www.daypilot.org/api/pro/latest/html/T_DayPilot_Web_Ui_Events_Month_BeforeEventRenderEventHandler.htm
(Sorry, linking into HTML frames sucks. Navigation for docs gets lost this way.)

Note: My team and I find that the WebForm documentation is extremely disappointing and nearly useless.

Is there something fundamental I am missing in how DP works? I assumed that using the ASP.NET WebForms DLL version would allow me to perform everything via C# code via code-behind. Are we expected to be access DP differently?

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

1. Sorry, I assumed you were talking about the Scheduler control which supports both server-side export and client-side export. You can hook the client-side events with the ASP.NET WebForms version as well if needed (but it's not the standard way).

2. DayPilot Month didn't support e.FontColor in BeforeEventRender up to now but it's now available in the latest sandbox build:

http://www.daypilot.org/sandbox/

Example:

protected void DayPilotMonth1_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.Month.BeforeEventRenderEventArgs e)
{
  e.FontColor = "red";
}

It works for both browser rendering and image export.

Let me know if it doesn't work as expected. The improvement will be included in the next SP release which is scheduled for next week.

3. > Note: My team and I find that the WebForm documentation is extremely disappointing and nearly useless.

The API documentation at http://www.daypilot.org/api/pro/latest/ serves as a reference point for the API and doesn't go into much detail. We're trying to focus on the task-oriented documentation which is available at https://doc.daypilot.org. Anyway, thanks for taking the time and writing the feedback - if you're not happy with anything, we'd like to know that.

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