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

Format column content in Gantt

Asked by Roger
8 years ago.

I want to set a color on an entry in one column of the Gantt. I tried the following in DayPilotGantt1_BeforeTaskRender:

e.Row.Html = "<span style=\"color:red;\">" + tempTask.title1 + "</span>";
e.Tags["Status"] = "<span style=\"color:red;\">" + e.Tags["Status"] + "</span>";

First line works fine, second not. How to format the content of columns?

Thanks for support!

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

You should use e.Columns[1].Html to modify the second column HTML.

An example from the Project Management ASP.NET tutorial:
http://code.daypilot.org/64294/asp-net-gantt-project-management

protected void Gantt_OnBeforeTaskRender(object sender, BeforeTaskRenderEventArgs e)
{
  TimeSpan duration = e.End - e.Start;
  e.Row.Columns[1].Html = duration.ToString();
}

In your case:

protected void Gantt_OnBeforeTaskRender(object sender, BeforeTaskRenderEventArgs e)
{
  e.Row.Html = "<span style=\"color:red;\">" + tempTask.title1 + "</span>"; 
  e.Columns[1].Html = "<span style=\"color:red;\">" + e.Tags["Status"] + "</span>";
}

Let me know if it didn't help.

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