I have an XML field that I try to print it with commas in the thousands (example : 1,234)
this is my code :
<span><%=String.Format("{0:n}", dc.GetXMLField(nl[i], "PRICE")) + " ₪"%></span>
When I run this, I get the number without any commas (for example : 200000)
by the way, its a string..
thanks for the helpers.
dc.GetXMLFieldis returning a string, not a formatable number (int, decimal, etc), but in order forstring.Format("{0:n}", num)to work, num has to be anactualnumber, not a string representation of a number.If you know this will always be a number you could parse it into a number first, before attempting to format it: