Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Newbie Gridview Problem when editing currencies

Reply
Thread Tools

Newbie Gridview Problem when editing currencies

 
 
AAJ
Guest
Posts: n/a
 
      09-15-2006
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


 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      09-18-2006
What's adding the currency symbol to the value?

"AAJ" <a.a.com> wrote in message
news:...
> 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
>



 
Reply With Quote
 
 
 
 
AAJ
Guest
Posts: n/a
 
      09-18-2006
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

"Ken Cox [Microsoft MVP]" <> wrote in message
news:...
> What's adding the currency symbol to the value?
>
> "AAJ" <a.a.com> wrote in message
> news:...
>> 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
>>

>
>



 
Reply With Quote
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      09-18-2006
You could convert to template fields and then remove the ":C" from the
edititem template.

"AAJ" <a.a.com> wrote in message
news:...
> 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
>
> "Ken Cox [Microsoft MVP]" <> wrote in
> message news:...
>> What's adding the currency symbol to the value?
>>
>> "AAJ" <a.a.com> wrote in message
>> news:...
>>> 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
>>>

>>
>>

>
>



 
Reply With Quote
 
AAJ
Guest
Posts: n/a
 
      09-19-2006
Hi Ken

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

cheers

Andy



"Ken Cox [Microsoft MVP]" <> wrote in message
news:%...
> You could convert to template fields and then remove the ":C" from the
> edititem template.
>
> "AAJ" <a.a.com> wrote in message
> news:...
>> 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
>>
>> "Ken Cox [Microsoft MVP]" <> wrote in
>> message news:...
>>> What's adding the currency symbol to the value?
>>>
>>> "AAJ" <a.a.com> wrote in message
>>> news:...
>>>> 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
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JOIN FREE LIVE EDGE OF MARKET TRADING SESSIONS IN CURRENCIES, INDICES& STOCKS hawkeyetrade@gmail.com C Programming 0 03-18-2008 12:00 AM
JOIN FREE LIVE EDGE OF THE MARKET TRADING IN FUTURES, STOCKS,CURRENCIES hawkeyetrade@gmail.com Computer Support 0 03-17-2008 11:54 PM
Newbie: Javascript to calculate between currencies? dysfunctional Javascript 5 04-22-2006 04:29 PM
Help: multiple currencies - how to get conversion rate mark | r ASP General 1 09-11-2004 12:45 AM
I need a currency converter for all the currencies techy techno ASP General 2 02-17-2004 09:27 PM



Advertisments