formatting datagrid column?

  • Thread starter Thread starter kai
  • Start date Start date
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
 
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."
 
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."
 
Back
Top