Adding a Unit Price Column

Crypto Ultimatum

How to earn money on Bitcoin exchange

Get Instant Access

Let's look now at how to add a Unit Price column. Ideally, we would show the price as currency and we can do this by applying a format string to the column.

Try It Out - Adding a Currency Column

1. Open the Property Builder for the DataGrid control one more time. Change to the Columns view as before and add a new Bound Column. Set the Header text to Unit Price and the Data Field to unitprice. Insert {0:c} in the Data formatting expression box. This isn't just an extravagant two-way smiley: it also tells ASP.NET that this column is a currency, as explained later.

2. Click OK and run the project. You should see the following:

Was this article helpful?

0 0

Post a comment