GanttExtension.Bind(Object, Object, Object, Object) Method
Binds the Gantt to a data source.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.2.dll
Declaration
public GanttExtension Bind(
object taskObject,
object taskDependencyObject,
object resourceObject,
object resourceAssignmentObject
)
Parameters
Name | Type | Description |
---|---|---|
taskObject | Object | The task object. |
taskDependencyObject | Object | The task dependency object. |
resourceObject | Object | The resource object. |
resourceAssignmentObject | Object | The resource assignment object. |
Returns
Type | Description |
---|---|
GanttExtension | The Gantt extension. |
Remarks
@Html.DevExpress().Gantt(settings => {
settings.Name = "gantt";
// ...
settings.Mappings.Task.Key = "ID";
settings.Mappings.Task.ParentKey = "ParentID";
settings.Mappings.Task.Title = "Subject";
settings.Mappings.Task.Start = "StartDate";
settings.Mappings.Task.End = "EndDate";
settings.Mappings.Task.Progress = "PercentComplete";
settings.Mappings.Dependency.Key = "ID";
settings.Mappings.Dependency.PredecessorKey = "ParentID";
settings.Mappings.Dependency.SuccessorKey = "DependentID";
settings.Mappings.Dependency.DependencyType = "Type";
settings.Mappings.Resource.Key = "ID";
settings.Mappings.Resource.Name = "Name";
settings.Mappings.ResourceAssignment.Key = "ID";
settings.Mappings.ResourceAssignment.TaskKey = "TaskID";
settings.Mappings.ResourceAssignment.ResourceKey = "ResourceID";
}).Bind(
GanttDataProvider.Tasks,
GanttDataProvider.Dependencies,
GanttDataProvider.Resources,
GanttDataProvider.ResourceAssignments
).GetHtml()
public static class GanttDataProvider {
const string
TasksSessionKey = "Tasks",
DependenciesSessionKey = "Dependencies",
ResourcesSessionKey = "Resources",
ResourceAssignmentsSessionKey = "ResourceAssignments";
static HttpSessionState Session { get { return HttpContext.Current.Session; } }
public static List<Task> Tasks {
get {
if(Session[TasksSessionKey] == null)
Session[TasksSessionKey] = CreateTasks();
return (List<Task>)Session[TasksSessionKey];
}
}
public static List<Dependency> Dependencies {
get {
if(Session[DependenciesSessionKey] == null)
Session[DependenciesSessionKey] = CreateDependencies();
return (List<Dependency>)Session[DependenciesSessionKey];
}
}
public static List<Resource> Resources {
get {
if(Session[ResourcesSessionKey] == null)
Session[ResourcesSessionKey] = CreateResources();
return (List<Resource>)Session[ResourcesSessionKey];
}
}
public static List<ResourceAssignment> ResourceAssignments {
get {
if(Session[ResourceAssignmentsSessionKey] == null)
Session[ResourceAssignmentsSessionKey] = CreateResourceAssignments();
return (List<ResourceAssignment>)Session[ResourceAssignmentsSessionKey];
}
}
static List<Task> CreateTasks() {
//...
}
static List<Dependency> CreateDependencies() {
//...
}
static List<Resource> CreateResources() {
//...
}
static List<ResourceAssignment> CreateResourceAssignments() {
//...
}
}
See Also