We have a datatable that is bound to a calendarinfo instance with a dayview control on the form. When we add a new row to our datatable, the dayview control doesn't always display that new appointment. How can force the dayview or calendarinfo control to refresh from the bound datatable? The problem is odd, it doesn't always happen but when it does all new rows added to the datatable do not show.
DataTable:
Public Shared Function CreateTrafficActionsDT() As DataTable Dim dt As New DataTable("traffic_actions") dt.Columns.Add("id", GetType(Integer)) dt.Columns.Add("isdirty", GetType(Boolean)) dt.Columns.Add("ownerid", GetType(Integer)) dt.Columns.Add("leadid", GetType(Integer)) dt.Columns.Add("servicecustomerid", GetType(String)) dt.Columns.Add("stockno", GetType(String)) dt.Columns.Add("date_start", GetType(DateTime)) dt.Columns.Add("date_end", GetType(DateTime)) dt.Columns.Add("reminder_enabled", GetType(Boolean)) dt.Columns.Add("reminder_interval", GetType(Integer)) dt.Columns.Add("alldayflag", GetType(Boolean)) dt.Columns.Add("subject", GetType(String)) dt.Columns.Add("subject2", GetType(String)) dt.Columns.Add("description", GetType(String)) dt.Columns.Add("action", GetType(String)) dt.Columns.Add("status", GetType(String)) dt.Columns.Add("allproperties", GetType(Byte())) dt.Columns.Add("leadname", GetType(String)) dt.Columns.Add("namefirst", GetType(String)) dt.Columns.Add("namelast", GetType(String)) dt.Columns.Add("phonehome", GetType(String)) dt.Columns.Add("phonework", GetType(String)) dt.Columns.Add("phonemobile", GetType(String)) dt.Columns.Add("email", GetType(String)) dt.Columns("id").DefaultValue = 0 dt.Columns("isdirty").DefaultValue = False dt.Columns("ownerid").DefaultValue = 0 dt.Columns("leadid").DefaultValue = 0 dt.PrimaryKey = New DataColumn() {dt.Columns("id")} Return dt End Function
CalendarInfo Binding:
With ci.DataBindingsForAppointments .DataSource = Nothing .DataKeyMember = "id" .AllDayEventMember = "alldayflag" .AllPropertiesMember = "allproperties" .AllPropertiesMemberSerializationMode = Infragistics.Win.UltraWinSchedule.DateSerializationMode.SerializeDatesAsLocalTime .DescriptionMember = "description" .EndDateTimeMember = "date_end" .OwnerKeyMember = "ownerid" .ReminderEnabledMember = "reminder_enabled" .ReminderIntervalMember = "reminder_interval" .StartDateTimeMember = "date_start" .SubjectMember = "subject2" .BindingContextControl = bc .DataSource = AppointmentTable End With
I could not reproduce the behavior you describe here with a simple test (I used the WinSchedule Database Demo sample). To speculate wildly, it would seem possible that the data source just happens to be empty every other time you call RefreshData, i.e., the application code is causing the problem. If possible post a small sample that demonstrates the problem so we can take a look.
I have a similar issue. Were you able to resolve this issue.
I call the RefreshData method as mentioned above. For some reason my appointment data appears and disappears on my dayview control on every other call to refresh the data. Initially the appointments show up, then I refresh to synchronize the calendar controls with my database and the appointments are gone, on the next refresh they're back...and the cycle repeats.
any ideas, this is really annoying.
Try calling the UltraCalendarInfo.DataBindingsForAppointments.RefreshData method. Alternatively, clearing then resetting the DataSource property might do the trick, although there are performance ramifications with that approach.