I am using the DataBinder.Eval expression in an ASP.NET Datagrid, but I think this question relates to formatting strings in .NET in general. The client requested that if the string value is 0, it should not be displayed. I have the following hack to accomplish this:
<%# IIf(DataBinder.Eval(Container.DataItem, "MSDWhole").Trim = "0", "", DataBinder.Eval(Container.DataItem, "MSDWhole", "{0:N0}")) %>
I would like to change the formatting expression {0:N0} so that I can exclude the IIf statement, but cannot find anything that works.
Randy eppinger
source share