views:

24

answers:

2

I have a GridView that is bound to a DataTable, which in turn uses a TableAdapter, like so:

ResultTableAdapter tableAdapter = new ResultTableAdapter();
ResultDataTable dataTable= tableAdapter.GetResult(id);
gridView.DataSource = dataTable;

This gridview displays many columns with numbers in them. Now I have to display the numbers in thousands with one decimal.

E.g. the number "24753" from the database should be displayed like "24,8" in the gridview.

What's the cleanest way of accomplishing?

+1  A: 

You can use "DataFormatString" property to specify custom number format - check thousands number scaling using ',' in this article. I guess a format string such as "#,##0,.0" should do the trick for you.

VinayC
A: 

I ended up changing the contents of the GridView afterwards, since I found no fast and nice solution to display the numbers in thousands. But it feels wrong.

Microserf