I am using a DataBinder.Eval expression in an ASP.NET Datagrid, but I think this question applies to String formatting in .NET in general. The customer has requested that if the value of a string 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 {0:N0}
formatting expression so that I can eliminate the IIf statement, but can t find anything that works.