Example of Constraints in ASP.NET MVC Gantt Chart Control
This sample illustrates how to apply and visualize task constraints in a Gantt Chart. Task constraints define specific scheduling rules that determine when a task can start or finish, based on project requirements or dependencies.
In Gantt Chart, task constraints define the rules that limit a task start or end date based on project scheduling needs. The following constraint types are supported:
As Soon As Possible- Task starts as early as possible. Default for auto-scheduled tasks.As Late As Possible- Task finishes as late as possible without delaying dependent tasks.Must Start On- Task must start on the specified date.Must Finish On- Task must finish on the specified date.Start No Earlier Than- Task cannot start before the specified date.Start No Later Than- Task must start on or before the specified date.Finish No Earlier Than- Task cannot finish before the specified date.Finish No Later Than- Task must finish on or before the specified date.
You can assign constraints to a task using the taskFields.constraintType and taskFields.constraintDate properties.
Constraints can also be updated interactively through the task edit dialog.
Handling constraint violation popup:
To control or suppress the constraint violation dialog, handle the actionBegin event with requestType as validateTaskViolation.
Use args.validateMode to specify how to respond to constraint conflicts. Available properties include:
respectMustStartOnrespectMustFinishOnrespectStartNoLaterThanrespectFinishNoLaterThan
These options are false by default, which means the violation popup appears. To suppress the popup and cancel conflicting changes silently, set the relevant flag(s) to true.