Update with $ sign

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
 
M

Mark Fitzpatrick

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
 
D

David C

Thanks. I think I wil use a validator control and force currency. That
seems to work.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,174
Messages
2,570,940
Members
47,485
Latest member
Andrewayne909

Latest Threads

Top