Labels in ASP.NET MVC Gantt component

3 Jan 20241 minute to read

The Gantt control maps any data source fields to task labels using the LabelSettings.LeftLabel, LabelSettings.RightLabel, and LabelSettings.TaskLabel properties. You can customize the task labels with templates.

@Html.EJS().Gantt("Gantt").DataSource((IEnumerable<object>)ViewBag.DataSource).Height("450px").TaskFields(ts => ts.Id("TaskId").Name(
      "TaskName").StartDate("StartDate").EndDate("EndDate").Duration("Duration").Progress("Progress").Child("SubTasks")).LabelSettings(ls =>
       ls.LeftLabel("TaskId").RightLabel("Task Name: ${taskData.TaskName}").TaskLabel("${Progress}%")).Render()
public IActionResult Index()
{
    ViewBag.DataSource = GanttData.ProjectNewData();
    return View();
}

Alt text