(re)format output (data type) from SQLServer to DataGrid

D

D. Shane Fowlkes

I have a couple of fields in SQL Server which are defined as "Money". One is
"Quantity" and the other is "Unit Price". Unit Price I can understand being
defined as "money" but I'm not sure why the DBA defined QTY as money.
Changing the datatype to Integer in the database isn't an option here so I'm
hoping someone can present a workaround.

In a datagrid, the data in the fields is written to the aspx page as
"1.0000" even though only "1" is stored in the database. Using a DataGrid
that's bound to a DataSet, how can I format the output to the page so that
QTY just shows as "1" AND Unit Price shows as "$1.00"? Thanks!!



<asp:BoundColumn HeaderText="Quantity" DataField="Quantity"
ItemStyle-Width="10%" ItemStyle-CssClass="caption" />

<asp:BoundColumn HeaderText="Unit Price" DataField="UnitPrice"
ItemStyle-Width="15%" ItemStyle-CssClass="caption" />
 
D

D. Shane Fowlkes

I managed to find DataFormatString as an attribute of the BoundColumn but I
don't know what syntax to use? Does anyone know the syntax to use to format
output as a Integer AND/OR US Currency?
 

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,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top