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

Parents
No Data
Reply
  • 53790
    posted

    Hello Jeni,

    Thanks for attached code. I see, that you implemented one of my suggestion. I have few small remarks (maybe because you do not include it in the forum thread )

    1. Please note that you should clear your DataSet and TableAdapters before to Fill it again

    2. Please remove :

    //Choose which project to be show in the GanntView                

    this.ultraGanttView1.Project = this.ultraGanttView1.CalendarInfo.Projects[0];

    3. In my scenario I used UltraCombo control with RowSelected() event to choose different projects.  The could be:

    private void ucProjects_RowSelected(object sender, RowSelectedEventArgs e)

            {

                if (e.Row != null)

                {

                    ultraGanttView1.Enabled = true;

                    ProjectKey = e.Row.Cells["ProjectKey"].Text;

                    dbTasksTableAdapter1.FillByProjectKey(dbDataSetTasks1.dbTasks, ProjectKey);

                }

            }

     Please take a look on attached video file for more details. If you have any questions, please do not hesitate to write me

     

    Video890.rar
Children