Gridview column formatting

E

et

I have tried everything to display a bound column in a gridview to 2
decimals only. The column is a price, and when I run the query in sql, he
value displays as 10.00. Yet in the grid view it displays as 10.0000. I
have tried various settings in the dataformatstring, and it seems to ignore
everything I put there; I've tried: {0}, {0:F2}, {0:d}, {0:c}, among
others. What am I doing wrong?
 
A

Alvin Bruney [MVP]

hook into the itemdatabound event handler and set the cell the way you want
it. consider
e.item.cells[colInQuestion].Text = "#.##";//picture format
 

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

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top