Asked by:
Currency Format in Datalist, Label

Question
-
User-706647060 posted
hi ! I can displays the number value as currency format but I wanna show it as Euro, English sterling and USd !
<asp:Label runat="server" ID="UnitPriceLabel" Text='<%# Eval("UnitPrice", "{0:C}") %>' />
I used the above code ! What can I do ?
Friday, May 7, 2010 8:32 PM
All replies
-
User-706647060 posted
No answer for that ?:(
Saturday, May 8, 2010 2:13 AM -
User-1636183269 posted
create base page, go through below forum
http://forums.asp.net/t/1514920.aspx
objCultureInfo.NumberFormat.CurrencyDecimalSeparator = ","
objCultureInfo.NumberFormat.CurrencyGroupSeparator = "."
objCultureInfo.NumberFormat.CurrencySymbol = "€"
Thread.CurrentThread.CurrentCulture = objCultureInfoIf you will pass or set culture then default culture and format will automatically set.
Saturday, May 8, 2010 2:21 AM -
User630150075 posted
<asp:Label ID="lblUnitPriceCur" runat="server" Text='<%# Eval("CountryCurrency") %>'></asp:Label><asp:Label ID="lblUnitPrice" runat="server" Text='<%# Eval("UnitPrice") %>'></asp:Label>Keep two label: one for currency symbol and other for price
<asp:Label ID="lblCur" runat="server" Text='<%# Eval("CountryCurrency") %>'></asp:Label>
<asp:Label ID="lblPrice" runat="server" Text='<%# Eval("UnitPrice") %>'></asp:Label>
Saturday, May 8, 2010 2:26 AM -
User-706647060 posted
create base page, go through below forum
http://forums.asp.net/t/1514920.aspx
objCultureInfo.NumberFormat.CurrencyDecimalSeparator = ","
objCultureInfo.NumberFormat.CurrencyGroupSeparator = "."
objCultureInfo.NumberFormat.CurrencySymbol = "€"
Thread.CurrentThread.CurrentCulture = objCultureInfoIf you will pass or set culture then default culture and format will automatically set.
Hi thanks a lot ! But I have the other currencies in my page ! I need GBp, USD and EUR ! So can't I do something like that;
<%# Eval("UnitPrice", "{0:C}") %>
Saturday, May 8, 2010 2:30 AM -
User-1636183269 posted
Could you please sample how you want to display on UI?
Because I think it will diffcult for user to read if two differenet currency display on same UI like below
1 AC EURO-1200
2 PC DOLLAR-120
3 TV INR-1200
will prefer
1 AC EURO-1200
2 PC DOLLAR-120
3 TV Rs-1200
will prefer below
1 AC Rs-1200
2 PC Rs-120
3 TV Rs-1200
May be your requirement, can u give example.
Saturday, May 8, 2010 4:06 AM -
User-706647060 posted
I am gonna displaye the fees of a product on both GBP and EUR. How could I do that man ?
Saturday, May 8, 2010 5:59 AM -
User758108839 posted
for dollar below code can help , you need to change the culture code if you want
protected void dListItems_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { // Set the format of the currency to be dollar Label lblPrice = (Label)e.Item.FindControl("lblPrice"); if (!lblPrice.Text.Equals("")) { double value = Convert.ToDouble(lblPrice.Text); lblPrice.Text = value.ToString("C3", CultureInfo.CreateSpecificCulture("en-US")); } } }
Wednesday, March 20, 2013 10:06 AM