You must Sign In to post a response.

Display negative values in gridview

Hi all,

I have a gridview which dispalys the negative numbers in a column like ($2.00). It automatically applies brackets where it gets negative value.

How to restrict it and my coulumn should show negative like -$2.00.

Please help

thanks
Vineet


Comments

Author: sharad28 Oct 2011 Member Level: Bronze   Points : 2

String.Format("{0:$#,##0.00;($#,##0.00);Zero}", value);

This will output "$1,240.00? if passed 1243.50. It will output the
same format but in parentheses if the number is negative, and will
output the string "Zero" if the number is zero.

Author: sharad28 Oct 2011 Member Level: Bronze   Points : 3

Uae a TemplateField instead:

http://msdn.microsoft.com/en-us/library/bb288032.aspx[^]

Your code woould then be something like:


Collapse | Copy Code