Saturday, March 24, 2012

Working with Euros

My web application needs to show prices in £ and €.

Can u give me any guidance as to how to display prices in Euro.

Currently, I have 2 'money' columns in my database and then i am using

<%# DataBinder.Eval(Container.DataItem, "EuroPrice", "{0:c}") %>

to display the euro price. But as u can see this would automatically display the £ sign in front of the price.

So my question is: how can I display 2 different currencies on my asp.net app

Thanks


I suggest that you do the following:

<%# "€" + DataBinder.Eval(Container.DataItem, "EuroPrice") %> [C#]

<%# "€" + DataBinder.Eval(Container.DataItem, "EuroPrice") %> [VB.NET]


thanks.

Now, "€" displays the € sign and DataBinder.Eval(Container.DataItem, "EuroPrice") displays the price as 300.0000

How can I display the price as 300.00 instead of 300.0000 ( I am using 'money' column type in my DB).

Can I do it through asp.net or do I have to change the 'EuroPrice' in my DB from 'money' column type to some other?


Try:

DataBinder.Eval(Container.DataItem, "EuroPrice", {0:#.##})


I got it working as:
<%# "€" + DataBinder.Eval(Container.DataItem, "EuroPrice", "{0:##.00}") %>
thanks

Hey ,

I have a problem, I am entering € in a textbox, and it saves as '?' in my database, the display in my textbox , after postback is also '?'

Can someone help me on this,

Thanks.

0 comments:

Post a Comment