I just started working with gantt view, so I have some questions
Can we include multiple projects in ultraGanttView?
I want to use a List as datasource, actually i am working like this
ultraCalendarInfoGanttView.DataBindingsForProjects.BindingContextControl = this; ultraCalendarInfoGanttView.DataBindingsForProjects.DataSource = new ProjectManager().GetProjects();ultraCalendarInfoGanttView.DataBindingsForTasks.BindingContextControl = this;ultraCalendarInfoGanttView.DataBindingsForTasks.DataSource = new TaskManager().GetTasks();
But I didn't get any data in view, please help me to figure out this.
mayank164 said:Can we include multiple projects in ultraGanttView?
Our UltraCalendarInfo could conatins one or more Projects in the ProjectCollection, but UltraGanttView control could show only one project. So if you have two or more projects you should switch between projects. For example:
this.ultraGanttView1.Project = this.ultraGanttView1.CalendarInfo.Projects[2];
Could you please take a look in our online documentation about the binding
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/WinGanttView.html
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/WinGanttView_Using_WinGanttView.html
and let me know if you have any questions.
Regards
Thanks for considering this post also
I take the look of the link you given me, but in that tasks are added one by one can't we assign some data source,so that grid will populate all tasks and also get viewed in Gantt view
I did like this
TestDataSet dataSet = new TestDataSet(); TestDataSetTableAdapters.PROJECTSTableAdapter project1 = new TestDataSetTableAdapters.PROJECTSTableAdapter(); ultraCalendarInfo1.DataBindingsForProjects.DataSource = project1.GetData(); ultraCalendarInfo1.DataBindingsForProjects.IdMember = "Id"; ultraCalendarInfo1.DataBindingsForProjects.KeyMember = "ProjectId"; ultraCalendarInfo1.DataBindingsForProjects.NameMember = "ProjectName"; ultraCalendarInfo1.DataBindingsForProjects.StartDateMember = "StartDate"; ultraCalendarInfo1.DataBindingsForProjects.RefreshData(); TestDataSetTableAdapters.TASKSTableAdapter Tasks1 = new TestDataSetTableAdapters.TASKSTableAdapter(); ultraCalendarInfo1.DataBindingsForTasks.DataSource = Tasks1.GetData(); ultraCalendarInfo1.DataBindingsForTasks.NameMember = "TaskName"; ultraCalendarInfo1.DataBindingsForTasks.DurationMember = "DaysLeft"; ultraCalendarInfo1.DataBindingsForTasks.StartDateTimeMember = "StartDate"; ultraCalendarInfo1.DataBindingsForTasks.IdMember = "Id"; ultraCalendarInfo1.DataBindingsForTasks.ProjectKeyMember = "ProjectId"; ultraCalendarInfo1.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskId"; ultraCalendarInfo1.DataBindingsForTasks.PercentCompleteMember = "Progress"; ultraCalendarInfo1.DataBindingsForTasks.RefreshData(); int i = ultraCalendarInfo1.Tasks.Count; ultraGanttViewProjects.Project =ultraGanttViewProjects.CalendarInfo.Projects[1];
Gantt view didn't show any data.I found that from GetData() I get 1 row but task count value of i is zero
Is there some thing wrong?
Hi,
Could you please take a look at the attached sample for more details. Also there are SQL scrip that create a tables and some data for the test. Please let me know if you have any questions.
Thanks again
But I can't run that that code there is version conflict I am using 4.0. I check the code it seems to be alright .Is there possibility that this is because of back end?
I have attached the tables script ,there is no relationship b/w tables and also no pkey .Help me out for this problem
I have changed my back end and make it as you did, but problem is not sort out
ultraCalendarInfo2.DataBindingsForTasks.DataSource = dataSet.Tables[1]; int j = dataSet.Tables[1].Rows.Count;//value 2 this.ultraCalendarInfo2.DataBindingsForTasks.NameMember = "TaskName"; this.ultraCalendarInfo2.DataBindingsForTasks.DurationMember = "TaskDuration"; this.ultraCalendarInfo2.DataBindingsForTasks.StartDateTimeMember = "TaskStartTime"; this.ultraCalendarInfo2.DataBindingsForTasks.IdMember = "TaskId"; this.ultraCalendarInfo2.DataBindingsForTasks.ProjectKeyMember = "ProjectKey"; this.ultraCalendarInfo2.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskId"; this.ultraCalendarInfo2.DataBindingsForTasks.PercentCompleteMember = "TaskPercentComplete"; this.ultraCalendarInfo2.DataBindingsForTasks.AllPropertiesMember = "AllProperties"; int k1 = this.ultraCalendarInfo2.Tasks.Count;// value 0 this.ultraCalendarInfo2.DataBindingsForTasks.RefreshData(); int k = this.ultraCalendarInfo2.Tasks.Count;// value 0
but when i done like this
ganttProject = new Project(); ganttProject.Key = project.ProjectName; ganttProject.Name = project.ProjectName; ganttProject.StartDate = project.StartDate; ultraCalendarInfo1.Projects.Add(ganttProject); ultraGanttViewProjects.Project = ganttProject; Infragistics.Win.UltraWinSchedule.Task ganttTask = null; foreach (Entity.Task task in tasksList) { ganttTask = new Infragistics.Win.UltraWinSchedule.Task(); ganttTask.Project = ganttProject; ganttTask.Name = task.TaskName; ganttTask.StartDateTime = task.StartDate; ganttTask.PercentComplete = task.Progress; ultraCalendarInfo1.Tasks.Add(ganttTask); } It works fine, but is too lengthy process.My question is "Why data binding not work?"
Thanks for reply.
I suppose that you are using ultraCalendarInfo1_AfterAppointmentAdded() event to update your database only for the fields that you bind to your UltraCalendarInfo. If you want to update your DB with data from your extra fields, just call update method of your TableAdapter (only for these fields) when you press a button from the win form that add a tasks.
mayank164 said: In database I have start date and end date not duration column,So how I show task by calculating duration?
If you have start and end date, so you could calculate the task`s duration. You could do this in your C# code or in your database. For example:
C# DateTime startDate = DateTime.Today; DateTime endDate = DateTime.Today.AddDays(10); TimeSpan diffDate = endDate.Subtract(startDate); MessageBox.Show("Days difference = "+ diffDate.Days.ToString()); SQL DECLARE @BegDate DATETIME DECLARE @EndDate DATETIME SET @BegDate = GETDATE() SET @EndDate = DATEADD(dd, 10, GETDATE()) PRINT DATEDIFF(dd, @BegDate,@EndDate) Let me know if you have any questions. Regards
C#
DateTime startDate = DateTime.Today;
DateTime endDate = DateTime.Today.AddDays(10);
TimeSpan diffDate = endDate.Subtract(startDate);
MessageBox.Show("Days difference = "+ diffDate.Days.ToString());
SQL
DECLARE @BegDate DATETIME
DECLARE @EndDate DATETIME
SET @BegDate = GETDATE()
SET @EndDate = DATEADD(dd, 10, GETDATE())
PRINT DATEDIFF(dd, @BegDate,@EndDate)
Let me know if you have any questions.
I'll explain you,I have a form to add task, in that form I have some extra field which do not allow null. I don't want that user enter value for field in gantt chart and there is no need to show in gantt chart so I didn't bind them with calendarInfo .now when user add task these fields also get initialized with some default data in datatable so I can insert task.
I think you understand.
I have one more query
In database I have start date and end date not duration column,So how I show task by calculating duration?
I`m not sure what is your scenario, but maybe you could handle ultraCalendarInfo1_AfterAppointmentAdded() event and using e.Appointment properties you could update your data table. I`m not sure where you are bind this table, but all available data in your UltraCalendarInfo will be represent in the UltraGanttView. Of course you could hide some columns from your task grid.
Let me know if you think that I misunderstood your scenario
Thanks,
This is alright.Also give the answers of second part of question
when task is added I want to initialize some columns with some values in data table only and don't want to show in tasks grid.