Databinding Error when Recreating object
Posted
by Maxim Gershkovich
on Stack Overflow
See other posts from Stack Overflow
or by Maxim Gershkovich
Published on 2010-04-26T13:42:14Z
Indexed on
2010/04/26
13:43 UTC
Read the original article
Hit count: 326
Hi All,
Figure there is a simple solution to this problem but I have been unable to find it.
I have databinding in an ASP.Net application to a GridView. This gridview is bound to an ObjectDataSource as per standard usage.
The problem I have is that one of my bound fields uses the property DataFormatString="{0:C}" and due to the currency format being displayed when an update is attempted and the object recreated I get a error as such "$13.00 is not a valid value for Decimal."
Clearly this is a result of the column using a FormatString and then attempting to bind it back to a decimal property I have in my object called UnitPrice.
I am assuming there is some markup I can set that can specify how the value is translated back?
Thanks in advance for any help.
© Stack Overflow or respective owner