zimmer9
asked on
How to display amount values with just a decimal point, comma seperators and a leading hyphen for negative values but with no dollar sign in a GridView in ASP.NET?
I am developing my first ASP.NET application in C# using VS2010.
I placed a (Data) GridView control on a Web Form.
For one of the fields titled AMT, this field that has an amount value and I just
want it to display the "Decimal point" and "Comma separator" as the DataFormatString.
How would I display the field in the GridView with just a decimal point and (thousands) comma separator. I don't want the dollar sign. And for negative amounts, I want to precedie the amount with a dash.
For ex:
-80,000.00
33.12
I placed a (Data) GridView control on a Web Form.
For one of the fields titled AMT, this field that has an amount value and I just
want it to display the "Decimal point" and "Comma separator" as the DataFormatString.
How would I display the field in the GridView with just a decimal point and (thousands) comma separator. I don't want the dollar sign. And for negative amounts, I want to precedie the amount with a dash.
For ex:
-80,000.00
33.12
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The formatting I want is to put a dash in front of a negative number
and place a decimal point and (thousands) comma separator into a numeric value.
Thus, if the GridView row field is pulling from a database a value of 64786, the amount would be displayed in the GridView as 64,786.00
And if the GridView row field pulls in from a database a value of -221, it would appear in the GridView as -221.00.
The GridView field amount field is stored in default.aspx as follows:
If the GridView control cannot handle this editing "AMOUNT" field, then can the following ASPX CODE be modified to handle the reformatting of the AMOUNT field?
<asp:BoundField DataField="amount" HeaderText="Amount" SortExpression="amount" />