Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
705
Change format of column from string to currency
posted

I have an editable grid where all the columnns are string values.  For one of the columns the user enters a number, after they click a button it verifies their inputs and after that I want to format this verified column to currency.  I thought this would work fine

ultraGrid1.DisplayLayout.Bands[0].Columns["Money"].Format = "$nnn,nnn.nn";

ultraGrid1.DisplayLayout.Bands[0].Columns["Money"].MaskInput = $nnn,nnn.nn";

 

But only the mask input is displaying correctly and the format is not.  So I did some searching and some people suggested using a currencyeditor so I tried this code which also didnt work

 

Infragistics.Win.UltraWinEditors.UltraCurrencyEditor c = new Infragistics.Win.UltraWinEditors.UltraCurrencyEditor();

c.FormatString = "$nnn,nnn.nn";

ultraGrid1.DisplayLayout.Bands[0].Columns["Money"].EditorComponent = c;

im thinking im missing some simple step but after reading numerous posts I cant figure it out.

 

Parents
No Data
Reply
  • 69832
    Offline posted

    The problem is that the data type is string. UltraCurrencyEditor expects the System.Decimal data type. The .NET numeric formatting tokens won't work on a string because a string is basically considered to already be formatted.

Children