I cannot see data in GanttInitializer populate


#1

I already setup and create file and class in (https://docs.dhtmlx.com/gantt/desktop__howtostart_dotnet.html) accordingly. But cannot see any thing init data populate in Gantt Chart.

        protected override void Seed(GanttContext context)
        {
            List<GanttTask> tasks = new List<GanttTask>()
            {
                 new GanttTask() { Id = 1, Text = "Project #2", StartDate = DateTime.Now.AddHours(-3),
                     Duration = 18, SortOrder = 10, Progress = 0.4m, ParentId = null },
                 new GanttTask() { Id = 2, Text = "Task #1", StartDate = DateTime.Now.AddHours(-2),
                     Duration = 8, SortOrder = 10, Progress = 0.6m, ParentId = 1 },
                 new GanttTask() { Id = 3, Text = "Task #2", StartDate = DateTime.Now.AddHours(-1),
                     Duration = 8, SortOrder = 20, Progress = 0.6m, ParentId = 1 }
            };

            tasks.ForEach(s => context.GanttTasks.Add(s));
            context.SaveChanges();

            List<GanttLink> links = new List<GanttLink>()
            {
                 new GanttLink() { Id = 1, SourceTaskId = 1, TargetTaskId = 2, Type = "1" },
                 new GanttLink() { Id = 2, SourceTaskId = 2, TargetTaskId = 3, Type = "0" }
            };

            links.ForEach(s => context.GanttLinks.Add(s));
            context.SaveChanges();
        }

Help me. Thanks.


#2

Hello Annuar,
Have you checked a ready demo that has all the necessary configurations?
Here is the link: