locked
Show US Dollor charater RRS feed

  • Question

  • Hello & Thanks in Advance.

     

    I created a search page where a user can check a Part Number then it takes you to the result page to show the P/N, Desc & Price.  The price only shows a number Ex: 350, but I would like it to show $350.00 instead.

     

    Thanks

    KJG

    Thursday, December 15, 2011 6:26 PM

All replies

  • You have to first tell us how you are displaying that result in order for us to tell you how to display it formated with $.

    Thursday, December 15, 2011 7:43 PM
  • Hello Kathy,

     

    Here are the steps I took,

    1. Created a Page called Search using ASPX

    2. installed a text box & button form the toolbox

    3.  Did all the steps required to make it work correctly which it does.

    4.  created a page called results, also using ASPX

    5, Installed a Gridview feature

    6.  Went thru the steps to use an Access database file.  Works fine.

    So now I would like to have the dollar amount shown for a part when a search is done shown with a currency US dollar character. 

     

    Hope this helps.

    Regards KJG

    Thursday, December 15, 2011 8:09 PM
  • You need to format the output of that GridView column.

    In the <columns> area of your GridView (look in Code View), you should have something similar to:

    <asp:BoundField HeaderText="Price"
                    DataField="UnitPrice" SortExpression="UnitPrice"
                    DataFormatString="{0:c}">

     

    It's the DataFormatString you need.  What is above says, "Take the value (the 0 means plug in the value), and format it as currency (the syntax is value:format, and "c" means currency).

    You can add this in Code View to the appropriate line, or use the GridView actions in DesignView and select "Edit Columns", and in that window, click the appropriate Selected Field that is your price, and on the right find DataFormatString, and type the format in there.

    Thursday, December 15, 2011 9:52 PM