Malachi
Malachi

Reputation: 33690

Number formatting in C#

I am trying to format a number in a GridView that is in pounds into pence.

e.g. 0.0106 to 1.06

Is it possible to archive this with the DataFormatString on the GridView? Or would it make more sense to do the conversion within the stored procedure?

Upvotes: 0

Views: 309

Answers (1)

Marcel de Kleine
Marcel de Kleine

Reputation: 146

You like to display the number in the GridView, so convert it as close to the GridView as possible. It is definitely a presentation thing, so do it in that layer of your application.

Using the DateFormatString is correct as this is specifically designed to do what you wish.

Finally, my idea of conversion in the database is that conversion is not something a database was designed for.

Upvotes: 1

Related Questions