Hi,
I was trying to add a custom field to the EditAppointment dialog of my scheduler. The field is a combobox and I can select a value, but the mapping doesn't work, its always null. Here are some code snippets:
MainForm:
AppointmentWithNewFields Class:
AppointmentWithNewFieldsEditForm
AppointmentsWithNewFieldsFactory:
What did I wrong? Can anyone help me please?
Thanks + greetings
Daniel
I was trying to add a custom field to the EditAppointment dialog of my scheduler. The field is a combobox and I can select a value, but the mapping doesn't work, its always null. Here are some code snippets:
MainForm:
Public Sub New() InitializeComponent() AddHandler Me.RadScheduler.AppointmentEditDialogShowing, AddressOf RadScheduler_AppointmentEditDialogShowing Me.RadScheduler.AppointmentFactory = New AppointmentWithNewFieldsFactory Me.SchedulerBindingDataSource1.EventProvider.AppointmentFactory = New AppointmentWithNewFieldsFactory Dim appointmentMappingInfo As AppointmentMappingInfo = TryCast(Me.SchedulerBindingDataSource1.EventProvider.Mapping, AppointmentMappingInfo) appointmentMappingInfo.Mappings.Add(New SchedulerMapping("CustomField", "CustomFieldDatabase"))End Sub Private appointmentDialog As IEditAppointmentDialog = Nothing Private Sub RadScheduler_AppointmentEditDialogShowing(sender As Object, e As AppointmentEditDialogShowingEventArgs) Handles RadScheduler.AppointmentEditDialogShowing If Me.appointmentDialog Is Nothing Then Me.appointmentDialog = New AppointmentWithNewFieldsEditForm() End If e.AppointmentEditDialog = Me.appointmentDialog End SubAppointmentWithNewFields Class:
Imports Telerik.WinControls.UIPublic Class AppointmentWithNewFields Inherits Appointment Public Sub New() MyBase.New() End Sub Private _CustomField As Integer Public Property CustomField() As Integer Get Return Me._CustomField End Get Set(value As Integer) If Me._CustomField <> value Then Me._CustomField = value Me.OnPropertyChanged("CustomField") End If End Set End PropertyAppointmentWithNewFieldsEditForm
Imports Telerik.WinControls.UIPublic Class AppointmentWithNewFieldsEditForm Inherits Telerik.WinControls.UI.Scheduler.Dialogs.EditAppointmentDialog Public Sub New() InitializeComponent() End Sub Protected Overrides Sub LoadSettingsFromEvent(ByVal ev As IEvent) MyBase.LoadSettingsFromEvent(ev) Dim appointmentWithNewFields As AppointmentWithNewFields = TryCast(ev, AppointmentWithNewFields) If appointmentWithNewFields IsNot Nothing Then Me.ComboBoxCustomField.SelectedValue = appointmentWithNewFields.CustomField End If End Sub Protected Overrides Sub ApplySettingsToEvent(ByVal ev As IEvent) Dim appointmentWithNewFields As AppointmentWithNewFields = TryCast(ev, AppointmentWithNewFields) If appointmentWithNewFields IsNot Nothing Then appointmentWithNewFields.CustomField= Me.ComboBoxCustomField.SelectedValue End If MyBase.ApplySettingsToEvent(ev) End Sub Protected Overrides Function CreateNewEvent() As IEvent Return New AppointmentWithNewFields() End FunctionAppointmentsWithNewFieldsFactory:
Imports Telerik.WinControls.UIPublic Class AppointmentWithNewFieldsFactory Implements IAppointmentFactory#Region "IAppointmentFactory Members" Public Function CreateNewAppointment() As IEvent Implements IAppointmentFactory.CreateNewAppointment Return New AppointmentWithNewFields() End Function#End RegionEnd ClassWhat did I wrong? Can anyone help me please?
Thanks + greetings
Daniel