kavi
kavi

Reputation: 11

The C# String.Format() Format Controls

dgProducts.Columns["Unit Price"].DefaultCellStyle.Format = "c";

When I execute this code it's displaying the money with $ sign (example: for 432 it is showing as $432.00). But I want "LKR" instead of '$' sign. Is it possible to do that? please help me!

Upvotes: 0

Views: 189

Answers (1)

Mick
Mick

Reputation: 6864

To override the regional settings on the client set the FormatProvider.

dgProducts.Columns["Unit Price"].DefaultCellStyle.Format = "c";
dgProducts.Columns["Unit Price"].DefaultCellStyle.FormatProvider =  new CultureInfo("si-LK");

But a better idea would be not to do this and simply ensure that the regional settings on the client are correct

Upvotes: 4

Related Questions