Hi all,
I'm new to this control, and I'm trying to understand the MultipleResources stuff. I'm able to set up the calendar with multiple resources (thanks to some posts on the forum), but I'm not able to add events.
I'm using C# with the following code:
String strConnectionString = @"Provider=XML;Data Source=c:\CalendarMultipleSchedulesSample.xtp_cal";
CalendarResources resoures = new CalendarResources(); CalendarResource res0 = new CalendarResource(); CalendarResource res1 = new CalendarResource();
res0.SetDataProvider2(strConnectionString, true);
CalendarSchedules schedules = res0.DataProvider.Schedules;
if (schedules.Count < 1) { schedules.AddNewSchedule("John"); schedules.AddNewSchedule("Jane"); res0.DataProvider.Save(); }
schedules[0].Id = 100; res0.Name = schedules[0].Name; res0.ScheduleIDs.Add(schedules[0].Id);
schedules[1].Id = 101; res1.SetDataProvider(res0.DataProvider, false); res1.Name = schedules[1].Name; res1.ScheduleIDs.Add(schedules[1].Id);
resoures.Add(res0); resoures.Add(res1); wndCalendarControl.SetMultipleResources(resoures);
wndCalendarControl.Populate(); wndCalendarControl.RedrawControl();
//Add test event DateTime fromTime = DateTime.Now; DateTime toTime = new DateTime(2006, 8, 22, 11, 11, 11);
CalendarEvent calEvent = res0.DataProvider.CreateEvent(); calEvent.StartTime = fromTime; calEvent.EndTime = toTime; calEvent.Subject = "Hallo"; calEvent.ScheduleID = schedules[0].Id; res0.DataProvider.AddEvent(calEvent);
wndCalendarControl.ActiveView.SetSelection(DateTime.Now, toTime, false);
wndCalendarControl.Populate(); wndCalendarControl.RedrawControl();
The code I'm struggeling with is the part after //Add test event
The event simply never appears in the calendar...
Could someone please point me in the right direction??
Best regards,
Gøran
|