Update with $ sign

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

I have an asp.net FormView that is displaying a money field as shown below.

<asp:TextBox ID="txtInitialClaim" runat="server" Text='<%#
Bind("InitialClaim", "{0:c}")%>' Width="120px"></asp:TextBox>

When the update command runs it throws an error because the dollar sign is
in the field. I want the user to be able to enter or view the $ sign. Is
there any way around this to avoid the error? Thanks.

David
 
Your best bet is to strip it out before you attempt to save it. Keep in
mind, datatypes such as money often don't have the $ actually stored in
there since it's not numeric. In SQL Server, for example, the money datatype
is an 8-byte number, not a textual string so you have to strip out the extra
decorations such as the $.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP- Expression
 
Thanks. I think I wil use a validator control and force currency. That
seems to work.

David
 
Back
Top