keitn
keitn

Reputation: 1298

C# Custom display formatting for String fields

I would like to be able to apply the following display masks in c# to doubles to produce formatted strings.

For example I want the following display masks:

The display masks are input by a user so can be wide in nature. They can also contain text. I have been able to do similar using a DevExpress AspxGridView, a column has a DisplayFormatString that I can use.

e.g. I have a variable named FormatString (e.g. "Total Spend: €0,.00;(0,.00)") which a user enters, I can assign to a grid column like:

       columnDisplayFormatString = FormatString

I need to do something similar in a Web Service so can't use any third party UI components.

I know I can always parse the format string and derive the parameters needed for String.Format but this could get quite messy.

Upvotes: 2

Views: 1958

Answers (1)

Peter
Peter

Reputation: 521

There's alot of information available here about string formats: http://msdn.microsoft.com/en-us/library/0c899ak8.aspx

Upvotes: 2

Related Questions