Hello,
I have a project with Ultraganttview and UltracalendarInfo.
Everything is okay but the Start Date and Finish Date is wrong. It always takes the date from today and not the days from my database.
this.ultraCalendarInfo1.DataBindingsForTasks.StartDateTimeMember is set to my column but it won't work.
How can I do it that start and end date is taken from my database?
greets
Hello Marvin,
I have been investigating into this behavior you are reporting, and there are quite a few things that could be at work here. Without seeing any code, the best recommendation that I can make here is to ensure that the Project that you are assigning to your UltraGanttView has its StartDate set accordingly, otherwise today's date will be what is used and all of the Tasks will be reformatted to be based on today's date as well.
If this does not work or you are already setting the StartDate of your Project, then would it be possible for you to please include the code that you are using to set up your UltraGanttView project and its tasks so I may be able to offer a more definite answer on this matter?
Please let me know if you have any other questions or concerns.
Hello Andrew,
thanks for the fast reply.
DataSet ds = new DataSet(); OdyDataAdapter odyDa = new OdyDataAdapter("SELECT * FROM AUFKOPF", new OdyConnection()); odyDa.Fill(ds, "AUFKOPF"); ds.Tables[0].Columns.Add("Duration", typeof(TimeSpan)); foreach (DataRow row in ds.Tables[0].Rows) { row["Duration"] = (DateTime)row["AUF_BDAT"] - (DateTime)row["AUF_VDAT"]; } this.ultraCalendarInfo1.ResetDateSettings(); this.ultraCalendarInfo1.DataBindingsForTasks.BindingContext = this.BindingContext; this.ultraCalendarInfo1.DataBindingsForProjects.BindingContext = this.BindingContext; this.ultraCalendarInfo1.DataBindingsForTasks.SetDataBinding(ds, "AUFKOPF"); this.ultraCalendarInfo1.DataBindingsForTasks.NameMember = "AUF_ANR"; this.ultraCalendarInfo1.DataBindingsForTasks.DurationMember = "Duration"; this.ultraCalendarInfo1.DataBindingsForTasks.StartDateTimeMember = "AUF_VDAT"; this.ultraCalendarInfo1.DataBindingsForProjects.StartDateMember = "AUF_VDAT"; this.ultraGanttView1.CalendarInfo = this.ultraCalendarInfo1; this.ultraGanttView1.Project = this.ultraGanttView1.CalendarInfo.Projects[0];
Here is my code -> "AUF_VDAT" is my start date, "AUF_BDAT" should be my EndDate.
The only thing that is really relevant here is the StartDate of the Project, as the EndDate will be determined by the length of the tasks that you set up with respect to the StartDate that is set.
There doesn't actually exist a mapping to the Project StartDate that I am personally aware of. I would recommend in this case that you query your data and get the earliest "AUF_VDAT" DateTime, and assign it to your Project.StartDate, as this will ensure that your Project starts when the first Task is meant to start.
Please let me know if you have any other questions or concerns on this matter.
how should it look like if the start date is "AUF_VDAT" and the end date is "AUF_BDAT"?
Thanks for the answer.
Thank you for your update.
From the code that you have provided, everything looks ok. What I am curious about now, though is how your Project is actually set up in this case. Namely, the Project element that exists at this.ultraGanttView1.CalendarInfo.Projects[0]. More specifically, have you set the StartDate on that particular Project? If not, the tasks in your Project will be reformatted based on today's date.