I am using a databound DropDownList in which the item's Text field is set to a text representation of an identifier value of type int. I am filling the Value field of the ListItem with the int value. All of this is being done through the setup of the DataTextField and DataValueField settings of the DropDownList control.
However, since both the item Value and Text fields are strings, obviously a conversion must be performed at the time of binding to convert the non-string value to a string value. I am making the assumption that the ToString() method for the value is invoked in order to convert the int value into a string so that it can be stored in the Value property of the ListItem.
Once selections are made, I read the Value property of the SelectedItem to perform an action. It occurred to me that converting back to the original data type might present a problem if the wrong culture information is used to perform the conversion.
My question is, in the case of non-string values being automatically converted for a databound DropDownList, what culture is used to perform that conversion?
My initial guess would be the CurrentCulture, simply because no object is required to supply a ToString() overload which allows the specification of an IFormatProvider object. However, if the System.Convert object is used to perform the conversion
View Complete Post