Information générale
Catégorie:
The Mere Mortals .NET Framework
Titre:
DropDownList with empty value
I have a drop down list control for Primary Analysts that needs a default item to be 'Not Selected' with an empty string for it's value.
In the database, that field is an int that allows nulls.
When the associated business object's Save method is called I get the error message at the end of this message.
This error message is being generated from the following method:
public static void BindBackValueData(ImmWebBindingList listControl, DataSet ds,
string tablename, string sourceMember)
which is found in the mmBindingStrategy class.
Error message:
Server Error in '/CreditMaster' Application.
--------------------------------------------------------------------------------
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 PrimaryAnalystID Column. Expected type is Int32.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: 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 PrimaryAnalystID Column. Expected type is Int32.
Source Error:
Line 294:
Line 295: // Now we can save the Customer object
Line 296: mmSaveDataResult result = this.Save(this.oCustomer);
Line 297: if (result == mmSaveDataResult.RulesPassed)
Line 298: {
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement