I want to show 12345.678
as 12,345
in my .cshtml file using Razor.
Is there any INLINE solution?
When I use:
<td> @(myValue != null ? myValue.ToString().Substring(myValue.ToString().IndexOf(".") + 1).ToString("#,##0") : '-')</td>
The error message is:
The best overloaded method match for '
string.ToString(System.IFormatProvider)
' has some invalid arguments
And for:
<td>@(myValue != null ? myValue.ToString().Format("{0:0}", myValue).ToString("#,##0") : '-')</td>
The error message is:
Member '
string.Format(string, object)
' cannot be accessed with an instance reference;