General information
Category:
The Mere Mortals .NET Framework
Title:
Input string was not in a correct format
I am having a problem with mmDropDownList control. The control is bound to a data source and gets its items from another table. if there are no items in the list to choose from then when saving the form, I get the following error: The dataField to which DropDownList is bound to may contain null value.
System.FormatException: Input string was not in a correct format. at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.String.System.IConvertible.ToInt32(IFormatProvider provider) at System.Convert.ToInt32(Object value) at System.Data.Common.Int32Storage.Set(Int32 record, Object value) at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't store <> in Ticket_Contact_id Column. Expected type is Int32.
If DropDownList is populated and I choose one of the valuse then you don't get the error.
This is also true with other controls, for-example if a textbox is bound to a DateTime Field then upon saving if the data field was null and a date is not typed in the textbox, you get the same error.
Does anyone know what's the best way to get round this issue.
Thanks,
Ilyas
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only