c# - Format price in Danish with curency symbol on right -
how can format price in eval() method price in danish , currency symbol on right c# ?
i have following in .aspx page display price:
<td class="text-right price-col"><%# eval("price", "{0:c}") %></td>
but display price e.g. kr. 79,00 .. want 79,00 kr.
i saw post changing currency symbol location in system.globalization.numberformatinfo , added method in codebehind gives me result want:
<td class="text-right price-col"><%# priceformat(79) %></td> protected string priceformat(decimal price) { system.globalization.cultureinfo danish = new system.globalization.cultureinfo("da-dk"); danish = (system.globalization.cultureinfo)danish.clone(); // adjust these suit danish.numberformat.currencypositivepattern = 3; danish.numberformat.currencynegativepattern = 3; decimal value = price; string output = value.tostring("c", danish); return output; }
but can use priceformat method eval() method right price parameter or modify format in eval() method same? example insert static value parameter (79).
eval returns object
, can cast decimal
, pass parameter priceformat
method:
<%# priceformat((decimal)eval("price")) %>
Comments
Post a Comment