I have one field in database, store price of my products. Its datatype is money and I want to format it like : 8.20, 10.00, and 100,00.00 This is my code :
$<%: string.Format("{0:00.00}", price)%>
But the output is not like what I want, anyone have any idea about that? Thanks.
尝试使用货币格式( 0:C
):
<%: string.Format("{0:C}", price) %>
I think you are looking for:
$<%: string.Format("{0:#0.00}", price)%>
This will skip the leading 0 for numbers under 10.
See the MSDN page for more information.
尝试这个:
<%: string.Format("{0:N2}", price) %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.