Syncfusion ASP.NET MVC Gantt Chart
The Syncfusion EJ2 Gantt Chart control for ASP.NET MVC renders a project schedule as a combined tree grid (left) and chart (right) separated by a splitter. Tasks are displayed as taskbars on a timeline. It supports task editing, dependencies, resources, baselines, critical path, filtering, sorting, and Excel/PDF export.
When to Use This Skill
Use this skill when you need to:
- Set up and render a Gantt Chart in an ASP.NET MVC view using
@Html.EJS().Gantt()
- Bind local or remote data to the Gantt control from a controller action
- Configure task fields, columns, and the chart timeline
- Enable editing (cell, dialog, taskbar), manage tasks (add/delete/update)
- Define task dependencies (FS, SS, FF, SF) and predecessors
- Assign and display resources on tasks
- Filter, sort, search, or select rows/cells
- Export to Excel, CSV, or PDF
- Customize the timeline, taskbars, labels, tooltips, holidays, event markers and data markers/indicators
- Configure task scheduling modes (Auto/Manual/Custom)
- Enable undo/redo, state persistence, virtual scrolling, or critical path
- Scroll the component, configure row height, or drag-and-drop rows
- Set timezone or localise the UI for different cultures and RTL languages
- Handle events (
ActionBegin, ActionComplete, CellEdit) or call public methods programmatically
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- NuGet package installation (
Syncfusion.EJ2.MVC5)
- Namespace import and CDN stylesheet/script setup
- ScriptManager registration in
_Layout.cshtml
- First Gantt control (
Index.cshtml + controller)
- Mapping task fields and defining columns
- Enabling editing, filtering, sorting
Data Binding
📄 Read: references/data-binding.md
- Local hierarchical data binding (parent/child objects with
SubTasks)
- Local flat/self-referential data binding (Id + ParentID mapping)
- Remote data with DataManager (URL Adaptor, OData, Web API)
- Load-on-demand with
HasChildMapping
Columns
📄 Read: references/columns.md
- Defining columns with Field, HeaderText, Width, Format, TextAlign
- Custom column headers and header templates
- Column templates and value accessors
- Checkbox column, frozen columns
- Column reordering, resizing, spanning
- Responsive columns, WBS column, column menu
Managing Tasks (Editing)
📄 Read: references/managing-tasks.md
IsPrimaryKey requirement for CRUD
- Cell editing, dialog editing, taskbar editing
- Adding and deleting tasks
- Indent / outdent tasks
- Splitting and merging tasks
- Customize Dependency, Segments, Resources tabs in the edit/add dialog using
AdditionalParams
- Customize Notes tab (RTE) in the edit/add dialog using
AdditionalParams (for example inlineMode)
- Server-side CRUD persistence
- Edit validation and error handling
Task Dependencies
📄 Read: references/task-dependency.md
- SS, SF, FS, FF relationship types
- Mapping
Dependency field in data source
- Predecessor offset with duration units
- Dependency editing via mouse drag
- Validation, error handling, parent dependencies
Resources
📄 Read: references/resources.md
- Resource collection and
ResourceFields mapping
- Assigning resources to tasks (
ResourceInfo)
- Resource view (
ViewType)
- Multi-taskbar display
- Resource customization
Filtering
📄 Read: references/filtering.md
- Menu filtering (
AllowFiltering(true)) — column-level filter menu
- Excel-like filtering (
FilterSettings.Type = Excel)
- Filter hierarchy modes (Parent, Child, Both, None)
- Toolbar search /
SearchSettings
- Filter operators, initial filter state, programmatic filtering
Sorting
📄 Read: references/sorting.md
- Enabling sorting, multi-column sort (
AllowSorting(true))
- Initial sort configuration via
SortSettings
- Programmatic sort (
sortModule.sortColumn) / clear sort
Timeline
📄 Read: references/timeline.md
- Top tier and bottom tier configuration
- Zooming in and out (
ZoomIn, ZoomOut, ZoomToFit)
- Custom timeline units and formats
- Timeline template
- Infinite timeline scrolling (
EnableInfiniteTimelineScroll)
Task Scheduling
📄 Read: references/task-scheduling.md
- Auto, Manual, Custom scheduling modes (
TaskMode)
- Duration units (Day, Hour, Minute, Week, Month)
- Unscheduled tasks
- Task constraints (ALAP, ASAP, FNLT, SNLT, MSO, MFO)
Baseline
📄 Read: references/baseline.md
- Baseline fields:
BaselineStartDate, BaselineEndDate, BaselineDuration
- Enable baseline with
RenderBaseline(true)
- Customize baseline color and CSS styling
- Baseline templates for custom rendering
- Multiple baseline rendering using task-specific fields
- Baseline milestones and advanced visualization
Selection
📄 Read: references/selection.md
- Row selection and cell selection
- Single/multiple selection modes (
SelectionSettings)
- Toggle selection and hover highlighting
- Programmatic selection (
selectionModule.selectRow, selectRows, selectCell)
- Selection events (
RowSelecting, RowSelected, CellSelecting, CellSelected)
Scrolling
📄 Read: references/scrolling.md
- Configure
Height and Width to enable scrollbars
- Responsive sizing with
100% and parent container height requirements
- Programmatic timeline scroll via
scrollToDate()
- Set vertical scroll with
setScrollTop() and updateChartScrollOffset()
Rows
📄 Read: references/rows.md
- Configure global
RowHeight and per-row expand state via TaskFields.ExpandState
- Collapse all parent tasks at load with
CollapseAllParentTasks
- Expand/collapse with toolbar and public methods (
expandAll(), collapseAll(), etc.)
- Customize expand/collapse behavior using
Expanding, Collapsing, Expanded, and Collapsed
- Customize row appearance with
RowDataBound and taskbar styling with QueryTaskbarInfo
- Styling alternate rows and per-cell customization (
RowDataBound + QueryCellInfo)
- Row spanning via
rowSpan in QueryCellInfo
- Control overflow rendering with
ClipMode
- Row template (
RowTemplate)
Row Drag And Drop
📄 Read: references/row-drag-and-drop.md
- Enable row reordering with
AllowRowDragAndDrop(true) and SelectionSettings.Type = Multiple for multi-drag
- Allow taskbar-based drag with
AllowTaskbarDragAndDrop(true) and edit mode Auto
- Lifecycle events:
RowDragStartHelper, RowDragStart, RowDrag, RowDrop
- Programmatic reordering via
reorderRows(fromIndexes, toIndex, position)
Timezone
📄 Read: references/timezone.md
- Set
Timezone() (e.g., "UTC", "America/New_York") to normalise displayed dates across clients
- CRUD operations respect configured timezone and convert for server persistence
- Utility methods:
ej.schedule.Timezone().offset(), convert(), and remove() for programmatic conversions
Globalization
📄 Read: references/globalization.md
- Localize UI text via
Locale() and ej.base.L10n.load() translation objects
- Internationalization: load CLDR files to format dates and numbers per culture
- Enable RTL layout with
EnableRtl(true) for right-to-left languages
Export (Excel & PDF)
📄 Read: references/export.md
- Excel export with column and data customization (
AllowExcelExport, excelExport())
- CSV export (
csvExport())
- PDF export with themes and custom columns (
AllowPdfExport, pdfExport())
- Exporting multiple Gantt charts to a single PDF or Excel file
Toolbar
📄 Read: references/toolbar.md
- Built-in toolbar items (Add, Edit, Delete, Search, ExpandAll, CollapseAll, ExcelExport, PdfExport, ZoomIn, ZoomOut, ZoomToFit, UndoRedo)
- Custom toolbar items and click handling
- Enabling/disabling toolbar items programmatically
Context Menu
📄 Read: references/context-menu.md
- Enable context menu with
EnableContextMenu(true)
- Built-in context menu items for CRUD operations
- Custom context menu items and click event handling
Taskbar
📄 Read: references/taskbar.md
- Taskbar height, custom templates (
TaskbarTemplate, ParentTaskbarTemplate, MilestoneTemplate)
- Progress bar customization and connector line configuration
- Data markers / indicators (per-task symbols with tooltip labels)
- Segment taskbars (split tasks) rendering
QueryTaskbarInfo event for per-task styling
Labels and Tooltips
📄 Read: references/labels-and-tooltips.md
- Left/right/inside label templates on taskbars (
LabelSettings)
- Taskbar tooltip customization via
TooltipSettings
- Connector line and baseline tooltips
BeforeTooltipRender event
Event Markers
📄 Read: references/event-markers.md
- Add event markers with
EventMarkers builder: Day, Label, CssClass
- Multiple event markers in a single Gantt
- Dynamic event markers
Critical Path
📄 Read: references/critical-path.md
- Enable critical path highlighting with
EnableCriticalPath(true)
- Critical path rendering and customization via
QueryTaskbarInfo
- Critical slack value configuration
Splitter
📄 Read: references/splitter.md
- Configure grid/chart pane ratio with
SplitterSettings
- Set splitter position by column index, percentage, or pixel
- Programmatic splitter position update via
setSplitterPosition()
Undo and Redo
📄 Read: references/undo-redo.md
- Enable undo/redo via toolbar items or
Ctrl+Z / Ctrl+Y with EnableUndoRedo(true)
- Configure undo-redo history size (
UndoRedoStepsCount)
- Supported actions and programmatic
undo() / redo() calls
State Persistence
📄 Read: references/state-persistence.md
- Enable persistence with
EnablePersistence(true) (saves to localStorage)
- Persisted properties: filter, sort, column width, scroll position, zoom level
- Clearing persisted state programmatically
Immutable Mode
📄 Read: references/immutable-mode.md
- Enable
EnableImmutableMode(true) to prevent re-render of unchanged rows
- Performance benefit for large data sets with frequent updates
- Limitations and usage patterns
Virtual Scroll
📄 Read: references/virtual-scroll.md
- Enable row virtualization with
EnableVirtualization(true)
- Enable timeline virtualization with
EnableTimelineVirtualization(true)
- Performance characteristics and known limitations
Loading Animation
📄 Read: references/loading-animation.md
- Built-in spinner shown during data load
- Show/hide loading indicator programmatically via
showSpinner() / hideSpinner()
LoadingIndicator with IndicatorType.Shimmer or IndicatorType.Spinner
Style and Appearance
📄 Read: references/style-and-appearance.md
- Applying Syncfusion themes (Bootstrap, Material, Fabric, High Contrast)
- CSS class overrides for taskbars, grid rows, and header
QueryTaskbarInfo event for per-task styling
GridLines enum (Horizontal, Vertical, Both, None)
Events
📄 Read: references/events.md
- Wire events via builder methods (
.ActionBegin("fn"), .ActionComplete("fn"), .ActionFailure("fn"))
ActionBegin — cancellable hook before every CRUD, filter, sort, zoom, and dependency action
ActionComplete — post-action callback with requestType reference table
CellEdit — prevent specific cells or rows from entering edit mode
BeforeTooltipRender — customise or suppress any tooltip dynamically
- Row/cell selection events:
RowSelecting, RowSelected, RowDeselecting, RowDeselected, CellSelecting, CellSelected
- Export events:
BeforeExcelExport, BeforePdfExport, ExcelExportComplete, PdfExportComplete
Public Methods
📄 Read: references/methods.md
- Data access:
getCurrentViewData(), getRecordByID(), getTaskByUniqueID(), getRowByID()
- Row expand/collapse:
expandAll(), collapseAll(), expandByID(), collapseByID(), expandByIndex()
- Task utilities:
convertToMilestone(), updateTaskId(), updateDataSource(), updateRecordByID()
- Scrolling:
scrollToDate(), scrollToTask(), setScrollTop(), updateChartScrollOffset()
- Search:
search(keyword) — programmatic search across displayed columns
- Selection:
selectCells() — programmatically select one or more cells
- Lifecycle:
refresh(), dataBind(), addEventListener(), removeEventListener()
Quick Start Example
Controller (HomeController.cs):
public ActionResult Index()
{
ViewBag.GanttData = GetGanttData();
return View();
}
public static List<GanttDataSource> GetGanttData()
{
return new List<GanttDataSource>
{
new GanttDataSource
{
TaskId = 1, TaskName = "Project Initiation",
StartDate = new DateTime(2024, 4, 2), EndDate = new DateTime(2024, 4, 21),
SubTasks = new List<GanttDataSource>
{
new GanttDataSource { TaskId = 2, TaskName = "Identify site", StartDate = new DateTime(2024, 4, 2), Duration = 4, Progress = 70 },
new GanttDataSource
{
TaskId = 3,
TaskName = "Soil test",
StartDate = new DateTime(2024, 4, 2),
Duration = 4,
Progress = 50,
Predecessor = "2FS",
Indicators = new List<GanttIndicator>
{
new GanttIndicator { Date = new DateTime(2024, 4, 4), IconClass = "e-btn-icon e-notes-info", Label = "Mid-review" }
}
}
}
}
};
}
public class GanttDataSource
{
public int TaskId { get; set; }
public string TaskName { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public int? Duration { get; set; }
public int Progress { get; set; }
public string Predecessor { get; set; }
public List<GanttIndicator> Indicators { get; set; }
public List<GanttDataSource> SubTasks { get; set; }
}
public class GanttIndicator
{
public string IconClass { get; set; }
public string Label { get; set; }
public DateTime Date { get; set; }
}
View (Index.cshtml):
@Html.EJS().Gantt("gantt")
.DataSource((IEnumerable<object>)ViewBag.GanttData)
.Height("450px")
.TaskFields(tf => tf
.Id("TaskId")
.Name("TaskName")
.StartDate("StartDate")
.EndDate("EndDate")
.Duration("Duration")
.Progress("Progress")
.Indicators("Indicators")
.Dependency("Predecessor")
.Child("SubTasks")
)
.EditSettings(es => es.AllowEditing(true).AllowAdding(true).AllowDeleting(true).AllowTaskbarEditing(true))
.Toolbar(new List<string> { "Add", "Edit", "Delete", "Update", "Cancel", "Search" })
.AllowSorting(true)
.AllowFiltering(true)
.Render()
Common Patterns
Pass resources from controller
ViewBag.Resources = GetResources(); // List<GanttResource>
@Html.EJS().Gantt("gantt")
.DataSource((IEnumerable<object>)ViewBag.GanttData)
.Resources((IEnumerable<object>)ViewBag.Resources)
.ResourceFields(rf => rf.Id("ResourceId").Name("ResourceName"))
.TaskFields(tf => tf.ResourceInfo("ResourceId") /* other fields */ )
.Render()
Enable critical path
@Html.EJS().Gantt("gantt")
.EnableCriticalPath(true)
/* other config */
.Render()
Enable Excel and PDF export with toolbar
@Html.EJS().Gantt("gantt")
.AllowExcelExport(true)
.AllowPdfExport(true)
.Toolbar(new List<string> { "ExcelExport", "PdfExport" })
.ToolbarClick("toolbarClick")
.Render()
<script>
function toolbarClick(args) {
var ganttObj = document.getElementById('gantt').ej2_instances[0];
if (args.item.id === 'gantt_excelexport') ganttObj.excelExport();
if (args.item.id === 'gantt_pdfexport') ganttObj.pdfExport();
}
</script>
1---2name: syncfusion-aspnetmvc-gantt-chart3description: Implement Syncfusion ASP.NET MVC Gantt Chart component (EJ2) for project management and task scheduling. Use this when working with Gantt charts, project timelines, task dependencies, or resource allocation in ASP.NET MVC applications using @Html.EJS().Gantt() Razor helpers. Covers data binding, task management, editing, filtering, sorting, export, timeline customization, events, and public methods.4---56# Syncfusion ASP.NET MVC Gantt Chart78The Syncfusion EJ2 Gantt Chart control for ASP.NET MVC renders a project schedule as a combined tree grid (left) and chart (right) separated by a splitter. Tasks are displayed as taskbars on a timeline. It supports task editing, dependencies, resources, baselines, critical path, filtering, sorting, and Excel/PDF export.910## When to Use This Skill1112Use this skill when you need to:13- Set up and render a Gantt Chart in an ASP.NET MVC view using `@Html.EJS().Gantt()`14- Bind local or remote data to the Gantt control from a controller action15- Configure task fields, columns, and the chart timeline16- Enable editing (cell, dialog, taskbar), manage tasks (add/delete/update)17- Define task dependencies (FS, SS, FF, SF) and predecessors18- Assign and display resources on tasks19- Filter, sort, search, or select rows/cells20- Export to Excel, CSV, or PDF21- Customize the timeline, taskbars, labels, tooltips, holidays, event markers and data markers/indicators22- Configure task scheduling modes (Auto/Manual/Custom)23- Enable undo/redo, state persistence, virtual scrolling, or critical path24- Scroll the component, configure row height, or drag-and-drop rows25- Set timezone or localise the UI for different cultures and RTL languages26- Handle events (`ActionBegin`, `ActionComplete`, `CellEdit`) or call public methods programmatically2728## Documentation and Navigation Guide2930### Getting Started31📄 **Read:** [references/getting-started.md](references/getting-started.md)32- NuGet package installation (`Syncfusion.EJ2.MVC5`)33- Namespace import and CDN stylesheet/script setup34- ScriptManager registration in `_Layout.cshtml`35- First Gantt control (`Index.cshtml` + controller)36- Mapping task fields and defining columns37- Enabling editing, filtering, sorting3839### Data Binding40📄 **Read:** [references/data-binding.md](references/data-binding.md)41- Local hierarchical data binding (parent/child objects with `SubTasks`)42- Local flat/self-referential data binding (Id + ParentID mapping)43- Remote data with DataManager (URL Adaptor, OData, Web API)44- Load-on-demand with `HasChildMapping`4546### Columns47📄 **Read:** [references/columns.md](references/columns.md)48- Defining columns with Field, HeaderText, Width, Format, TextAlign49- Custom column headers and header templates50- Column templates and value accessors51- Checkbox column, frozen columns52- Column reordering, resizing, spanning53- Responsive columns, WBS column, column menu5455### Managing Tasks (Editing)56📄 **Read:** [references/managing-tasks.md](references/managing-tasks.md)57- `IsPrimaryKey` requirement for CRUD58- Cell editing, dialog editing, taskbar editing59- Adding and deleting tasks60- Indent / outdent tasks61- Splitting and merging tasks62- Customize Dependency, Segments, Resources tabs in the edit/add dialog using `AdditionalParams`63- Customize Notes tab (RTE) in the edit/add dialog using `AdditionalParams` (for example `inlineMode`)64- Server-side CRUD persistence65- Edit validation and error handling6667### Task Dependencies68📄 **Read:** [references/task-dependency.md](references/task-dependency.md)69- SS, SF, FS, FF relationship types70- Mapping `Dependency` field in data source71- Predecessor offset with duration units72- Dependency editing via mouse drag73- Validation, error handling, parent dependencies7475### Resources76📄 **Read:** [references/resources.md](references/resources.md)77- Resource collection and `ResourceFields` mapping78- Assigning resources to tasks (`ResourceInfo`)79- Resource view (`ViewType`)80- Multi-taskbar display81- Resource customization8283### Filtering84📄 **Read:** [references/filtering.md](references/filtering.md)85- Menu filtering (`AllowFiltering(true)`) — column-level filter menu86- Excel-like filtering (`FilterSettings.Type = Excel`)87- Filter hierarchy modes (Parent, Child, Both, None)88- Toolbar search / `SearchSettings`89- Filter operators, initial filter state, programmatic filtering9091### Sorting92📄 **Read:** [references/sorting.md](references/sorting.md)93- Enabling sorting, multi-column sort (`AllowSorting(true)`)94- Initial sort configuration via `SortSettings`95- Programmatic sort (`sortModule.sortColumn`) / clear sort9697### Timeline98📄 **Read:** [references/timeline.md](references/timeline.md)99- Top tier and bottom tier configuration100- Zooming in and out (`ZoomIn`, `ZoomOut`, `ZoomToFit`)101- Custom timeline units and formats102- Timeline template103- Infinite timeline scrolling (`EnableInfiniteTimelineScroll`)104105### Task Scheduling106📄 **Read:** [references/task-scheduling.md](references/task-scheduling.md)107- Auto, Manual, Custom scheduling modes (`TaskMode`)108- Duration units (Day, Hour, Minute, Week, Month)109- Unscheduled tasks110- Task constraints (ALAP, ASAP, FNLT, SNLT, MSO, MFO)111112### Baseline113📄 **Read:** [references/baseline.md](references/baseline.md)114- Baseline fields: `BaselineStartDate`, `BaselineEndDate`, `BaselineDuration`115- Enable baseline with `RenderBaseline(true)`116- Customize baseline color and CSS styling117- Baseline templates for custom rendering118- Multiple baseline rendering using task-specific fields119- Baseline milestones and advanced visualization120121### Selection122📄 **Read:** [references/selection.md](references/selection.md)123- Row selection and cell selection124- Single/multiple selection modes (`SelectionSettings`)125- Toggle selection and hover highlighting126- Programmatic selection (`selectionModule.selectRow`, `selectRows`, `selectCell`)127- Selection events (`RowSelecting`, `RowSelected`, `CellSelecting`, `CellSelected`)128129### Scrolling130📄 **Read:** [references/scrolling.md](references/scrolling.md)131- Configure `Height` and `Width` to enable scrollbars132- Responsive sizing with `100%` and parent container height requirements133- Programmatic timeline scroll via `scrollToDate()`134- Set vertical scroll with `setScrollTop()` and `updateChartScrollOffset()`135136### Rows137📄 **Read:** [references/rows.md](references/rows.md)138- Configure global `RowHeight` and per-row expand state via `TaskFields.ExpandState`139- Collapse all parent tasks at load with `CollapseAllParentTasks`140- Expand/collapse with toolbar and public methods (`expandAll()`, `collapseAll()`, etc.)141- Customize expand/collapse behavior using `Expanding`, `Collapsing`, `Expanded`, and `Collapsed`142- Customize row appearance with `RowDataBound` and taskbar styling with `QueryTaskbarInfo`143- Styling alternate rows and per-cell customization (`RowDataBound` + `QueryCellInfo`)144- Row spanning via `rowSpan` in `QueryCellInfo`145- Control overflow rendering with `ClipMode`146- Row template (`RowTemplate`)147148### Row Drag And Drop149📄 **Read:** [references/row-drag-and-drop.md](references/row-drag-and-drop.md)150- Enable row reordering with `AllowRowDragAndDrop(true)` and `SelectionSettings.Type = Multiple` for multi-drag151- Allow taskbar-based drag with `AllowTaskbarDragAndDrop(true)` and edit mode `Auto`152- Lifecycle events: `RowDragStartHelper`, `RowDragStart`, `RowDrag`, `RowDrop`153- Programmatic reordering via `reorderRows(fromIndexes, toIndex, position)`154155### Timezone156📄 **Read:** [references/timezone.md](references/timezone.md)157- Set `Timezone()` (e.g., `"UTC"`, `"America/New_York"`) to normalise displayed dates across clients158- CRUD operations respect configured timezone and convert for server persistence159- Utility methods: `ej.schedule.Timezone().offset()`, `convert()`, and `remove()` for programmatic conversions160161### Globalization162📄 **Read:** [references/globalization.md](references/globalization.md)163- Localize UI text via `Locale()` and `ej.base.L10n.load()` translation objects164- Internationalization: load CLDR files to format dates and numbers per culture165- Enable RTL layout with `EnableRtl(true)` for right-to-left languages166167### Export (Excel & PDF)168📄 **Read:** [references/export.md](references/export.md)169- Excel export with column and data customization (`AllowExcelExport`, `excelExport()`)170- CSV export (`csvExport()`)171- PDF export with themes and custom columns (`AllowPdfExport`, `pdfExport()`)172- Exporting multiple Gantt charts to a single PDF or Excel file173174### Toolbar175📄 **Read:** [references/toolbar.md](references/toolbar.md)176- Built-in toolbar items (Add, Edit, Delete, Search, ExpandAll, CollapseAll, ExcelExport, PdfExport, ZoomIn, ZoomOut, ZoomToFit, UndoRedo)177- Custom toolbar items and click handling178- Enabling/disabling toolbar items programmatically179180### Context Menu181📄 **Read:** [references/context-menu.md](references/context-menu.md)182- Enable context menu with `EnableContextMenu(true)`183- Built-in context menu items for CRUD operations184- Custom context menu items and click event handling185186### Taskbar187📄 **Read:** [references/taskbar.md](references/taskbar.md)188- Taskbar height, custom templates (`TaskbarTemplate`, `ParentTaskbarTemplate`, `MilestoneTemplate`)189- Progress bar customization and connector line configuration190- Data markers / indicators (per-task symbols with tooltip labels)191- Segment taskbars (split tasks) rendering192- `QueryTaskbarInfo` event for per-task styling193194### Labels and Tooltips195📄 **Read:** [references/labels-and-tooltips.md](references/labels-and-tooltips.md)196- Left/right/inside label templates on taskbars (`LabelSettings`)197- Taskbar tooltip customization via `TooltipSettings`198- Connector line and baseline tooltips199- `BeforeTooltipRender` event200201### Event Markers202📄 **Read:** [references/event-markers.md](references/event-markers.md)203- Add event markers with `EventMarkers` builder: `Day`, `Label`, `CssClass`204- Multiple event markers in a single Gantt205- Dynamic event markers206207### Critical Path208📄 **Read:** [references/critical-path.md](references/critical-path.md)209- Enable critical path highlighting with `EnableCriticalPath(true)`210- Critical path rendering and customization via `QueryTaskbarInfo`211- Critical slack value configuration212213### Splitter214📄 **Read:** [references/splitter.md](references/splitter.md)215- Configure grid/chart pane ratio with `SplitterSettings`216- Set splitter position by column index, percentage, or pixel217- Programmatic splitter position update via `setSplitterPosition()`218219### Undo and Redo220📄 **Read:** [references/undo-redo.md](references/undo-redo.md)221- Enable undo/redo via toolbar items or `Ctrl+Z` / `Ctrl+Y` with `EnableUndoRedo(true)`222- Configure undo-redo history size (`UndoRedoStepsCount`)223- Supported actions and programmatic `undo()` / `redo()` calls224225### State Persistence226📄 **Read:** [references/state-persistence.md](references/state-persistence.md)227- Enable persistence with `EnablePersistence(true)` (saves to `localStorage`)228- Persisted properties: filter, sort, column width, scroll position, zoom level229- Clearing persisted state programmatically230231### Immutable Mode232📄 **Read:** [references/immutable-mode.md](references/immutable-mode.md)233- Enable `EnableImmutableMode(true)` to prevent re-render of unchanged rows234- Performance benefit for large data sets with frequent updates235- Limitations and usage patterns236237### Virtual Scroll238📄 **Read:** [references/virtual-scroll.md](references/virtual-scroll.md)239- Enable row virtualization with `EnableVirtualization(true)`240- Enable timeline virtualization with `EnableTimelineVirtualization(true)`241- Performance characteristics and known limitations242243### Loading Animation244📄 **Read:** [references/loading-animation.md](references/loading-animation.md)245- Built-in spinner shown during data load246- Show/hide loading indicator programmatically via `showSpinner()` / `hideSpinner()`247- `LoadingIndicator` with `IndicatorType.Shimmer` or `IndicatorType.Spinner`248249### Style and Appearance250📄 **Read:** [references/style-and-appearance.md](references/style-and-appearance.md)251- Applying Syncfusion themes (Bootstrap, Material, Fabric, High Contrast)252- CSS class overrides for taskbars, grid rows, and header253- `QueryTaskbarInfo` event for per-task styling254- `GridLines` enum (Horizontal, Vertical, Both, None)255256### Events257📄 **Read:** [references/events.md](references/events.md)258- Wire events via builder methods (`.ActionBegin("fn")`, `.ActionComplete("fn")`, `.ActionFailure("fn")`)259- `ActionBegin` — cancellable hook before every CRUD, filter, sort, zoom, and dependency action260- `ActionComplete` — post-action callback with `requestType` reference table261- `CellEdit` — prevent specific cells or rows from entering edit mode262- `BeforeTooltipRender` — customise or suppress any tooltip dynamically263- Row/cell selection events: `RowSelecting`, `RowSelected`, `RowDeselecting`, `RowDeselected`, `CellSelecting`, `CellSelected`264- Export events: `BeforeExcelExport`, `BeforePdfExport`, `ExcelExportComplete`, `PdfExportComplete`265266### Public Methods267📄 **Read:** [references/methods.md](references/methods.md)268- Data access: `getCurrentViewData()`, `getRecordByID()`, `getTaskByUniqueID()`, `getRowByID()`269- Row expand/collapse: `expandAll()`, `collapseAll()`, `expandByID()`, `collapseByID()`, `expandByIndex()`270- Task utilities: `convertToMilestone()`, `updateTaskId()`, `updateDataSource()`, `updateRecordByID()`271- Scrolling: `scrollToDate()`, `scrollToTask()`, `setScrollTop()`, `updateChartScrollOffset()`272- Search: `search(keyword)` — programmatic search across displayed columns273- Selection: `selectCells()` — programmatically select one or more cells274- Lifecycle: `refresh()`, `dataBind()`, `addEventListener()`, `removeEventListener()`275276## Quick Start Example277278**Controller (`HomeController.cs`):**279280```csharp281public ActionResult Index()282{283 ViewBag.GanttData = GetGanttData();284 return View();285}286287public static List<GanttDataSource> GetGanttData()288{289 return new List<GanttDataSource>290 {291 new GanttDataSource292 {293 TaskId = 1, TaskName = "Project Initiation",294 StartDate = new DateTime(2024, 4, 2), EndDate = new DateTime(2024, 4, 21),295 SubTasks = new List<GanttDataSource>296 {297 new GanttDataSource { TaskId = 2, TaskName = "Identify site", StartDate = new DateTime(2024, 4, 2), Duration = 4, Progress = 70 },298 new GanttDataSource299 {300 TaskId = 3,301 TaskName = "Soil test",302 StartDate = new DateTime(2024, 4, 2),303 Duration = 4,304 Progress = 50,305 Predecessor = "2FS",306 Indicators = new List<GanttIndicator>307 {308 new GanttIndicator { Date = new DateTime(2024, 4, 4), IconClass = "e-btn-icon e-notes-info", Label = "Mid-review" }309 }310 }311 }312 }313 };314}315316public class GanttDataSource317{318 public int TaskId { get; set; }319 public string TaskName { get; set; }320 public DateTime StartDate { get; set; }321 public DateTime EndDate { get; set; }322 public int? Duration { get; set; }323 public int Progress { get; set; }324 public string Predecessor { get; set; }325 public List<GanttIndicator> Indicators { get; set; }326 public List<GanttDataSource> SubTasks { get; set; }327}328329public class GanttIndicator330{331 public string IconClass { get; set; }332 public string Label { get; set; }333 public DateTime Date { get; set; }334}335```336337**View (`Index.cshtml`):**338339```cshtml340@Html.EJS().Gantt("gantt")341 .DataSource((IEnumerable<object>)ViewBag.GanttData)342 .Height("450px")343 .TaskFields(tf => tf344 .Id("TaskId")345 .Name("TaskName")346 .StartDate("StartDate")347 .EndDate("EndDate")348 .Duration("Duration")349 .Progress("Progress")350 .Indicators("Indicators")351 .Dependency("Predecessor")352 .Child("SubTasks")353 )354 .EditSettings(es => es.AllowEditing(true).AllowAdding(true).AllowDeleting(true).AllowTaskbarEditing(true))355 .Toolbar(new List<string> { "Add", "Edit", "Delete", "Update", "Cancel", "Search" })356 .AllowSorting(true)357 .AllowFiltering(true)358 .Render()359```360361## Common Patterns362363### Pass resources from controller364365```csharp366ViewBag.Resources = GetResources(); // List<GanttResource>367```368369```cshtml370@Html.EJS().Gantt("gantt")371 .DataSource((IEnumerable<object>)ViewBag.GanttData)372 .Resources((IEnumerable<object>)ViewBag.Resources)373 .ResourceFields(rf => rf.Id("ResourceId").Name("ResourceName"))374 .TaskFields(tf => tf.ResourceInfo("ResourceId") /* other fields */ )375 .Render()376```377378### Enable critical path379380```cshtml381@Html.EJS().Gantt("gantt")382 .EnableCriticalPath(true)383 /* other config */384 .Render()385```386387### Enable Excel and PDF export with toolbar388389```cshtml390@Html.EJS().Gantt("gantt")391 .AllowExcelExport(true)392 .AllowPdfExport(true)393 .Toolbar(new List<string> { "ExcelExport", "PdfExport" })394 .ToolbarClick("toolbarClick")395 .Render()396397<script>398function toolbarClick(args) {399 var ganttObj = document.getElementById('gantt').ej2_instances[0];400 if (args.item.id === 'gantt_excelexport') ganttObj.excelExport();401 if (args.item.id === 'gantt_pdfexport') ganttObj.pdfExport();402}403</script>404```