简体   繁体   中英

C# WindowsForm add string to Bounded Data in GridView

I'm using a dataGridView which got it's dataSource from a DataTable. One of the column there is named "productPrice", and the gridView column "Price" is bounded to it. The "productPrice" data contains just the price, and I want to add to every row in this column the '$' char. How can I do it ?

-I'm not using ASP.NET so I could do Eval("productPrice")+"$", I'm using WindowsForm.

Thank you

You will have to use the DefaultCellStyle.Format = "c" for the Price grid column.
("c" for currency)
Check this link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM