Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET - Negative numbers in Parenthesis

My application is currently displaying negative numbers as -1. The users have changed the requirements (just for a change!) and now we will have to display the numbers as (1). Can I enable that for the whole application say changing the web.config or even the app's CultureInfo ? Is there any side effect of doing that since we have lots of pages that contain number validators ?

Thanks !

like image 807
Andre Gallo Avatar asked Mar 02 '23 02:03

Andre Gallo


1 Answers

For currency it is really easy:

String.Format("{0:C}", value)

This will use the culture info for the system.

For normal numbers being data bound, use Mark Glorie's sample.

MSDN Article

like image 50
Tom Anderson Avatar answered Mar 05 '23 16:03

Tom Anderson