asp.net, vb - how to format number in unbound gridview
Posted on 2010-08-31
In a asp.net page, I'm populating a GridView in code by filling a DataSet, then binding the GridView's DataSource property to the DataSet (using SQL).
Some of my number columns need to be displayed using 2 decimal places.
In my sql query I made sure I rounded my numbers displayed 2 decimal places (Round(field, 2, 1)).
But when I run my code, 4 decimal places are shown.
So, how do I format numbers in an unbound gridview (in asp.net, vb) to show 2 decimal places?