formatting datagrid column?

K

kai

Hi, All
I populate a datagrid using dataset, read data from SQL Server database
"Northwind" database including "Customer", "Order" and "Orderdetails"
tables. When the "unit price" display in the datagrid, it does not have $
sign. How do I format "Unit Price " column with $ sign?

Thanks


Kai
 
K

Kevin Yu [MSFT]

Thanks for Bill's quick response!

Hi Kai,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to add a '$' before the unit
price value in DataGrid. If there is any misunderstanding, please feel free
to let me know.

Bill has provided us with a good article. We can subclass DataGrid and then
can format the columns. Here I have another way. If your DataGrid is just
for read purpose, you can add a column to the DataTable and set the new
column's expression to '$' + UnitPrice. Then you can hide the UnitPrice
column by setting its ColumnMapping property to MappingType.Hidden. Now we
can only see the column with $ in the DataGrid.

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
K

Kevin Yu [MSFT]

Hi Kai,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

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

Top