PrimeNY
asked on
Currency formatting in DataList
I have a data bound field in a DataList. Trying to format it to show currency ($300,000) using the following.
<span style="color: #0000cd">Price:
<asp:Label ID="BusPriceLabel" runat="server" Font-Bold="True" Font-Size="Medium"
Style="font-size: small; position: relative;" Text='<%# Eval("BusPrice", "${0:###,###}") %>' ForeColor="Black"></asp:La bel></span ></td>
Unfortunately this only produces "$300000". What am I doing wrong?
<span style="color: #0000cd">Price:
<asp:Label ID="BusPriceLabel" runat="server" Font-Bold="True" Font-Size="Medium"
Style="font-size: small; position: relative;" Text='<%# Eval("BusPrice", "${0:###,###}") %>' ForeColor="Black"></asp:La
Unfortunately this only produces "$300000". What am I doing wrong?
ASKER
the bachelor - Thanks but I've tried that and other similar versions and nothing seems to be recognized.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As an altenative you could try:
Text='<%# String.Format("{0:$#,###}" ,Eval("Bus Price"))
Text='<%# String.Format("{0:$#,###}"
ASKER
Got it. Problem was with the data type in the table. Had it as VarChar instead of Money. Thanks for your help.
Eval("BusPrice", "${0:#,###}")