I see the help DataBinding Support for WinGanttView and do the same code,but it look like not correct.
see pic:
task start time become the same.........
why???
Sorry, going by the screenshot nothing looks incorrect...please provide a more detailed description of the problem if possible and we'll try to help.
here is my code:
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using Infragistics.Win.UltraWinGanttView;using Infragistics.Win.UltraWinSchedule;namespace DataBinding_WinGanttView{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // Call the method that creates a DataSet DataSet ds = this.GetSampleData(); // Set the BindingContextControl property to reference this form this.ultraCalendarInfo1.DataBindingsForTasks.BindingContextControl = this; this.ultraCalendarInfo1.DataBindingsForProjects.BindingContextControl = this; // Set the DataBinding members for Projects this.ultraCalendarInfo1.DataBindingsForProjects.SetDataBinding(ds, "Projects"); this.ultraCalendarInfo1.DataBindingsForProjects.IdMember = "ProjectID"; this.ultraCalendarInfo1.DataBindingsForProjects.KeyMember = "ProjectKey"; this.ultraCalendarInfo1.DataBindingsForProjects.NameMember = "ProjectName"; this.ultraCalendarInfo1.DataBindingsForProjects.StartDateMember = "ProjectStartTime"; // Set the DataBinding members for Tasks this.ultraCalendarInfo1.DataBindingsForTasks.SetDataBinding(ds, "Tasks"); // Basic Task properties this.ultraCalendarInfo1.DataBindingsForTasks.NameMember = "TaskName"; this.ultraCalendarInfo1.DataBindingsForTasks.DurationMember = "TaskDuration"; this.ultraCalendarInfo1.DataBindingsForTasks.StartDateTimeMember = "TaskStartTime"; this.ultraCalendarInfo1.DataBindingsForTasks.IdMember = "TaskID"; this.ultraCalendarInfo1.DataBindingsForTasks.ProjectKeyMember = "ProjectKey"; this.ultraCalendarInfo1.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskID"; this.ultraCalendarInfo1.DataBindingsForTasks.PercentCompleteMember = "TaskPercentComplete"; // All other properties this.ultraCalendarInfo1.DataBindingsForTasks.AllPropertiesMember = "AllProperties"; // Since we are showing a task that belongs to an explicitly defined // project (i.e., not the UnassignedProject), assign that project to // the control's Project property so the control knows to display that project. this.ganntView1.CalendarInfo = this.ultraCalendarInfo1; this.ganntView1.Project = this.ganntView1.CalendarInfo.Projects[1]; } private DataSet GetSampleData() { DataSet theDataSet = new DataSet(); //string projectKey = rm.GetString("projectKey"); string projectKey = "projectKey"; DataTable theProjects = theDataSet.Tables.Add("Projects"); theProjects.Columns.Add("ProjectID"); theProjects.Columns.Add("ProjectKey"); theProjects.Columns.Add("ProjectName"); theProjects.Columns.Add("ProjectStartTime", typeof(DateTime)); // Assign values for each Project member theProjects.Rows.Add(new Object[] { Guid.NewGuid(), projectKey, "QuarterlyProject", DateTime.Today }); DataTable theTasks = theDataSet.Tables.Add("Tasks"); theTasks.Columns.Add("TaskID"); theTasks.Columns.Add("ProjectKey"); theTasks.Columns.Add("TaskName"); theTasks.Columns.Add("TaskStartTime", typeof(DateTime)); theTasks.Columns.Add("TaskDuration", typeof(TimeSpan)); theTasks.Columns.Add("ParentTaskID"); theTasks.Columns.Add("TaskPercentComplete"); //The Task properties are all covered by individual members. But we could save space in the database //By storing data as binary using AllProperties and not binding the other fields. theTasks.Columns.Add("AllProperties", typeof(Byte[])); Guid planningTaskid = Guid.NewGuid(); // Assign values for each Task member // Parent Task1 theTasks.Rows.Add(new Object[] { planningTaskid, projectKey, "Planning", DateTime.Now, TimeSpan.FromDays(5), null, null }); // Child Task1 of Parent Task1 theTasks.Rows.Add(new Object[] { Guid.NewGuid(), projectKey, "Prepare Budget", DateTime.Now, TimeSpan.FromDays(2), planningTaskid, 100 }); // Child Task2 of Parent Task1 theTasks.Rows.Add(new Object[] { Guid.NewGuid(), projectKey, "Allocate Teams", DateTime.Now.AddDays(2), TimeSpan.FromDays(3), planningTaskid, null }); // Parent Task2 Guid implementationTaskid = Guid.NewGuid(); theTasks.Rows.Add(new Object[] { implementationTaskid, projectKey, "Implementation", DateTime.Now.AddDays(6), TimeSpan.FromDays(16), null, null }); // Child Task1 of Parent Task2 Guid installationTaskid2 = Guid.NewGuid(); theTasks.Rows.Add(new Object[] { installationTaskid2, projectKey, "Installations", DateTime.Now.AddDays(6), TimeSpan.FromDays(2), implementationTaskid, 60 }); // Child Task2 of Parent Task2 theTasks.Rows.Add(new Object[] { Guid.NewGuid(), projectKey, "Execution", DateTime.Now.AddDays(8), TimeSpan.FromDays(13), implementationTaskid, null }); Guid testingTaskid = Guid.NewGuid(); // Parent Task3 theTasks.Rows.Add(new Object[] { testingTaskid, projectKey, "Testing", DateTime.Now.AddDays(23), TimeSpan.FromDays(20), null, null }); // Child Task1 of Parent Task3 theTasks.Rows.Add(new Object[] { Guid.NewGuid(), projectKey, "TestPhase1", DateTime.Now.AddDays(23), TimeSpan.FromDays(10), testingTaskid, 20 }); // Child Task2 of Parent Task3 theTasks.Rows.Add(new Object[] { Guid.NewGuid(), projectKey, "TestPhase2", DateTime.Now.AddDays(36), TimeSpan.FromDays(9), testingTaskid, null }); return theDataSet; } }}
in the code child task start time should not equal Parent task start time,but result is they are equal...
I also have the same problem...
If you compare the start column in the screenshot at the start of this topic to the screenshot in the example you can see that the start date for the child tasks eg "Allocate Teams" is showing the date of the project not the date as entered in the child tasks table, it looks like all the child tasks are just showing the project start date.
Is there a way to show the child task start date in the start column as entered in the tasks table?
Sorry, I didn't notice anything by looking at the screenshot, but now I see your point. The reason is that when the 'ConstraintMember' field is not set, the default value for the Constraint property will be used, which is 'AsSoonAsPossible', which usually makes the task start at the same time as the project. Using a value of 'StartNoEarlierThan' for the Constraint will cause the task to use the StartDateTime.
hellow brian .
im having the exact same problem
could you please send me an example of how to change the value of Constraint to 'StartNoEarlierThan'
thank you .
Just assign the name of the field that contains the Constraint values to the ConstraintMember property, and prepopulate the field with 'StartNoEarlierThan'.
Hello,
I am trying to bind WinGanttView using dataSet from database.
But it is not displaying in control.
can you share some example of binding WinGanttView using dataSet from database.
Thanks,
Imran