Hi,
I am having troubles with the DropDownList. I have bound the "SelectedValue"-property of the DropDownList to an int:
When typing something in the DropDownList everything is OK. But I a remove the typed Text I get a very strange exception:
Can anybody help?
I am having troubles with the DropDownList. I have bound the "SelectedValue"-property of the DropDownList to an int:
myDropDownList.DataBindings.Add(
"SelectedValue"
,
this
,
"myID"
,
false
, DataSourceUpdateMode.OnPropertyChanged);
When typing something in the DropDownList everything is OK. But I a remove the typed Text I get a very strange exception:
System.ArgumentException was unhandled
Message=Object of type
'System.DBNull'
cannot be converted to type
'System.Int32'
.
Source=System
StackTrace:
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
at System.Windows.Forms.BindToObject.SetValue(Object value)
at System.Windows.Forms.Binding.PullData(Boolean reformat, Boolean force)
at System.Windows.Forms.Binding.Target_PropertyChanged(Object sender, EventArgs e)
at Telerik.WinControls.UI.RadDropDownList.OnSelectedValueChanged(Object sender, Int32 newIndex, Object oldValue, Object newValue)
at Telerik.WinControls.UI.RadDropDownList.element_SelectedValueChanged(Object sender, ValueChangedEventArgs e)
at Telerik.WinControls.UI.RadDropDownListElement.OnSelectedValueChanged(Object sender, ValueChangedEventArgs e)
at Telerik.WinControls.UI.RadDropDownListElement.NotifyOwner(PopupEditorNotificationData notificationData)
at Telerik.WinControls.UI.PopupEditorElement.listElement_SelectedValueChanged(Object sender, EventArgs e)
at Telerik.WinControls.UI.RadListElement.OnSelectedValueChanged(Int32 newIndex)
at Telerik.WinControls.UI.RadListElement.OnSelectedIndexChanged(Int32 newIndex)
at Telerik.WinControls.UI.RadListElement.SetSelectedIndex(Int32 value)
at Telerik.WinControls.UI.RadDropDownListElement.set_SelectedIndex(Int32 value)
at Telerik.WinControls.UI.RadDropDownListElement.OnTextChanged(RadDropDownListEditableAreaElement sender, EventArgs args)
at Telerik.WinControls.UI.RadDropDownListElement.NotifyOwner(PopupEditorNotificationData notificationData)
at Telerik.WinControls.UI.RadDropDownListEditableAreaElement.textBox_TextChanged(Object sender, EventArgs e)
at Telerik.WinControls.RadItem.OnTextChanged(EventArgs e)
at Telerik.WinControls.RadItem.OnPropertyChanged(RadPropertyChangedEventArgs e)
at Telerik.WinControls.RadObject.RaisePropertyNotifications(RadPropertyValue propVal, Object oldValue, Object newValue, ValueSource oldSource)
at Telerik.WinControls.RadObject.SetValueCore(RadPropertyValue propVal, Object propModifier, Object newValue, ValueSource source)
at Telerik.WinControls.RadElement.SetValueCore(RadPropertyValue propVal, Object propModifier, Object newValue, ValueSource source)
at Telerik.WinControls.RadObject.OnTwoWayBoundPropertyChanged(PropertyBinding binding, Object newValue)
at Telerik.WinControls.PropertyBinding.UpdateSourceProperty(Object newValue)
at Telerik.WinControls.RadPropertyValue.SetLocalValue(Object value)
at Telerik.WinControls.RadObject.SetValueCore(RadPropertyValue propVal, Object propModifier, Object newValue, ValueSource source)
at Telerik.WinControls.RadElement.SetValueCore(RadPropertyValue propVal, Object propModifier, Object newValue, ValueSource source)
at Telerik.WinControls.UI.RadTextBoxItem.TextBoxControl_TextChanged(Object sender, EventArgs e)
Can anybody help?