Format Currency In DataGrid

D

Derek

Hi,

I am creating several datagrids via code on a page so I
do not have any Bound columns and I don't want any.
Problem is I need to format the last column as currency.
Anyone know how to do this without a BoundColumn? Is it
possible to get SQL server to return the data formatted
as currency? If so, how.


Thanks,

Derek
 
A

Alvin Bruney

in your itemdatabound do something like this
NumberFormatInfo nfi = new CultureInfo( "en-US", false ).NumberFormat;

nfi.CurrencyDecimalDigits = 2;

e.item.cells[e.item.cells.count - 1].text =
e.item.cells[e.item.cells.count - 1].text.toString("C",nfi);

i haven't tested this though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top