This is a migrated thread and some comments may be shown as answers.
how to use RecurrenceTask in an array?
1 Answer 5 Views
This is a migrated thread and some comments may be shown as answers.
yongcheol
Top achievements
Rank 1
yongcheol asked on 29 Jul 2020, 06:04 AM

<br>    RecurrenceTask[] RecurrenceTask_Array = new RecurrenceTask[3];
            for (int i = 0; i < RecurrenceTask_Array.Length; i++)
            {
                RecurrenceTask_Array[i] = new RecurrenceTask(today.AddYears(11), today.AddHours(1), "Recurrence Series" + i.ToString())
                {
                    Recurrences = { recurrenceTask1, recurrenceTask2, recurrenceTask3 }
                };
            }
            for (int i = 0; i < RecurrenceTask_Array.Length; i++)
            {
                gts[0].Children.Add(RecurrenceTask_Array[i]);
                gts[1].Children.Add(RecurrenceTask_Array[i]);
            }
            for (int i = 0; i < gts.Length; i++)
            {
                this.Tasks.Add(gts[i]);
            }

this source occur argumentException
can i use RecurrenceTask in array?

 


1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 31 Jul 2020, 12:13 PM

Hello Yongcheol,

Thank you for the shared code snippet. 

It seems that you are using the SameRowRecurringTask SDK example. I tested the specified code snippet and there isn't anything wrong with using the RecurrenceTask in an array. The problem is that the same object is added multiple times in the RadGanttView. You can notice that the in the 2nd for loop "RecurrenceTask_Array[i]" is added to the 1st and 2nd GanttTask. Instead, you need to create new instances of the RecurrenceTask objects. 

Please, find the mentioned SDK example updated to demonstrate how you can populate the RecurrenceTasks. Do check it out and let me know, if it helps. 

Regards,
Vladimir Stoyanov
Progress Telerik

Asked by
yongcheol
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or