Reputation: 14790
I have this code in ASP.NET 4.5
<span><%# Eval("Rating").ToString()+" " %></span>
to display the rating, but want to group the digits based on the user locale, how can I achieve this directly in aspx without code behind ? 1,000 instead of 1000
Upvotes: 0
Views: 376
Reputation: 155
You can try this.
<%#Eval("Rating","{0:0,00}").ToString() %>
Upvotes: 0
Reputation: 149040
You could use this:
<span><%# ((int)Eval("Rating")).ToString("n0")+" " %></span>
Or this:
<span><%# ((int)Eval("Rating")).ToString("#,###")+" " %></span>
Further Reading
Upvotes: 1
Reputation: 54801
Try:
Eval("Rating").ToString(CultureInfo.CurrentUICulture)
Assuming int
is the return type of Eval
Upvotes: 1