Link to home
Start Free TrialLog in
Avatar of PrimeNY
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:&nbsp;
                                        <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:Label></span></td>

Unfortunately this only produces "$300000".  What am I doing wrong?
Avatar of the_bachelor
the_bachelor

Try
Eval("BusPrice", "${0:#,###}")
Avatar of PrimeNY

ASKER

the bachelor - Thanks but I've tried that and other similar versions and nothing seems to be recognized.
ASKER CERTIFIED SOLUTION
Avatar of the_bachelor
the_bachelor

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As an altenative you could try:
Text='<%# String.Format("{0:$#,###}",Eval("BusPrice"))
Avatar of PrimeNY

ASKER

Got it.  Problem was with the data type in the table.  Had it as VarChar instead of Money.  Thanks for your help.