Welcome  This site hosts database tutorials and a few volunteer sub-websites.  
Login
Skip Navigation Links
Home
Database Tutorials
Become a Member
My Account
Contact Us
Portfolio
KRL Emails - Private
Rovers - Private
Shufflers
RCHS Reunion
FUMC Choir Music
Garden Club - Private
Award

Formatting a gridview column of numbers as currency

Back to the tutorials list

bulletIntroduction

In many situations, your database may contain numbers representing money, and you would like to show in, for example, a gridview, those number as currency, like $4,235.43 -- as dollars and cents.

bulletSetting a currency format for gridview data

With VWD, open your test website (it was named MyTutorialsWebsite), and then open the page called "DatabaseResultsPage.aspx". That page should display the database results you previously generated in a gridview, and the records include a Payment column that shows numbers. To convert those numbers to a currency format:

1. In the GridView, click the little expander arrow on the upper right, select Edit Columns, and highlight the Payment column.

2. In the Behavior section set htmlencode to False.

3. In the Data section, for the DataFormatString type: {0:C}

4. Click OK, save, Preview in Browser.

That should result in the data showing up as currency, like $433.50

Home   DatabaseTutorials   BecomeAMember   ContactUs    MyAccount   Portfolio   KRLEmails   Rovers   RCHS55Reunion
All graphics on this site are copyrighted