Newbie Gridview Problem when editing currencies

A

AAJ

Hi all

I posted this last week in a different group but had no response. I wonder
if any of you guys can help me.

I have a gridview that displays a field as a currency i.e. £100.00, which is
exactly what I want.

When I edit the row, the edit box for the column shows £100.00. This is
where the problem lies, if I save the record without deleting the currency
sign first, it fails with a conversion error. Obviously this is causing a
headache. I need the box to allow either £100.00 or just 100.00 and have it
accept either, after all its just a decimal behind the scenes.

does anyone know a way around it

many thanks in advance

Andy
 
A

AAJ

Hi Ken

Its in the datagrid itsself

I just used {0:c}in the data format string. This automatically carries
through to the edit field template

in the databinding of the edit field it has Bind("material_rate", "{0:C}")

cheers

Andy
 
K

Ken Cox [Microsoft MVP]

You could convert to template fields and then remove the ":C" from the
edititem template.
 
A

AAJ

Hi Ken

many thanks, works a treat now - {0:c} when displaying, {0:F2} when editing

cheers

Andy
 

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
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top