Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1310
DataBinding in WinGanntview
posted

In my application I have a number of projects listed in a ultracomboeditor. I am using the tableadapter method. The functionality to achieve is to bind the tasks in ultraganttview , accordingly in response to the value selected in the ultracomboeditor with projects.

The issue, is the tasks are not loading correctly in the ultraganttview, where as the tasks are bound in the tableadapter correctly. I have added the function which I call on ultracomboeditor Valuechanged event

public void LoadAllTasksByID(int Id)
        {
            try
            {
                if (Id < 0)
                    return;
                ganttDataSet1.Clear();
               

                //Fill DataSet
                projectsTableAdapter1.Fill(ganttDataSet1.Projects);
                dbTasksTableAdapter1.FillBy(ganttDataSet1.DbTasks,Id);




                ultraCalendarInfoProjects.DataBindingsForProjects.BindingContextControl = this;
                ultraCalendarInfoProjects.DataBindingsForTasks.BindingContextControl = this;


                ////  Set the DataBinding members for Projects
                this.ultraCalendarInfoProjects.DataBindingsForProjects.DataSource = ganttDataSet1.Projects;
                this.ultraCalendarInfoProjects.DataBindingsForProjects.IdMember = "ProjectId";
                this.ultraCalendarInfoProjects.DataBindingsForProjects.KeyMember = "Id";
                this.ultraCalendarInfoProjects.DataBindingsForProjects.NameMember = "ProjectName";
             

                //  Set the DataBinding members for Tasks
                this.ultraCalendarInfoProjects.DataBindingsForTasks.DataSource = ganttDataSet1.DbTasks;


                // Basic Task properties
                this.ultraCalendarInfoProjects.DataBindingsForTasks.NameMember = "TaskName";
                this.ultraCalendarInfoProjects.DataBindingsForTasks.DurationMember = "TaskDuration";
                this.ultraCalendarInfoProjects.DataBindingsForTasks.StartDateTimeMember = "TaskStartTime";

                this.ultraCalendarInfoProjects.DataBindingsForTasks.IdMember = "TaskID";
                this.ultraCalendarInfoProjects.DataBindingsForTasks.ProjectKeyMember = "ProjectKey";
                this.ultraCalendarInfoProjects.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskID";
                this.ultraCalendarInfoProjects.DataBindingsForTasks.PercentCompleteMember = "TaskPercentComplete";
                this.ultraCalendarInfoProjects.DataBindingsForTasks.AllPropertiesMember = "AllProperties";

                this.ultraGanttView1.CalendarInfo = this.ultraCalendarInfoProjects;


                //Choose which project to be show in the GanntView
                this.ultraGanttView1.Project = this.ultraGanttView1.CalendarInfo.Projects[0];


            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

Please reply where I have gone wrong.

Thanks