This is a migrated thread and some comments may be shown as answers.

smart DataFormatString

1 Answer 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Martin Roussel
Top achievements
Rank 1
Martin Roussel asked on 12 Dec 2011, 07:13 PM
Hi,

I have problems with formatting values that dont need to be precised. For instance, my grid can sometimes contains data that i want to show with 4 decimal digits (ex: 45.6785). For this, I use the formatting:  Column.DataFormatString = "{0:N4}". The problem is when this same grid displays number less precise (ex: 45.0). Users are complaining that they see too much digits for nothing: (ex: 45.0000). Is there a way to force the formatting to only apply when really needed? Like for instance specifying a maximum digit count so the formatting only apply when it needs to?

Thanks in advance,


Martin

1 Answer, 1 is accepted

Sort by
0
Tyree
Top achievements
Rank 2
answered on 12 Dec 2011, 10:13 PM
Are you looking to round, or truncate? If round, which style of rounding, ToEven or FromZero?
Tags
GridView
Asked by
Martin Roussel
Top achievements
Rank 1
Answers by
Tyree
Top achievements
Rank 2
Share this question
or