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.
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.
so my question still remains is there no way to display a string as a currency?
Hi,
Maybe I have one solution for your requirements, please try the example below and tell me is it useful for you:
1. Add in your application : ultraControlContainerEditor;
2. Use suitable event (for example : InitializeLayout event of your UltraGrid) and add there the code below:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit maskEditor = new Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit(); maskEditor.InputMask = "nnn,nnn.nn"; ultraControlContainerEditor1.EditingControl = maskEditor; UltraCurrencyEditor currencyEditor = new UltraCurrencyEditor(); ultraControlContainerEditor1.RenderingControl = currencyEditor; e.Layout.Bands[0].Columns["Money"].EditorComponent = ultraControlContainerEditor1; }
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit maskEditor = new Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit();
maskEditor.InputMask = "nnn,nnn.nn";
ultraControlContainerEditor1.EditingControl = maskEditor;
UltraCurrencyEditor currencyEditor = new UltraCurrencyEditor();
ultraControlContainerEditor1.RenderingControl = currencyEditor;
e.Layout.Bands[0].Columns["Money"].EditorComponent = ultraControlContainerEditor1;
}
Please send me a feedback and if you have any questions, please do not hesitate to ask.
Hello,
If you need any additional assistance with this case fill free to contact me. I will keep this case open for another three days while I am waiting for your response. If at that time you haven't responded, I will close it. Please note that closed cases may be reopened within thirty days of closure.
Regards
Georgi
Hi Tony,
I am still following your case. Have you been able to resolve your issue ? If you still have any concerns or questions I will be glad to help. If you need any additional assistance don’t hesitate to ask.