Hi. We recently upgraded our website from using Infragistics controls Version=9.1.20091.1015 to Version=11.1.20111.2064. On a given page we use the WebCurrencyEdit (several times), with the culture set so that negative numbers are shown as "-$n" instead of "($n)". Before the upgrade, users could paste negative values of either format and in both cases the value would properly be converted to a negative number in the "-$n" format. Since upgrading, a negative number pasted in the "($n)" format is converted to a positive number instead of a negative number in the other format (unless the culture is set to always display negative numbers in that format).
I tried the newer WebCurrencyEditor control and got the same behavior.
Unfortunately, our clients are adamant that the controls work the way they did previously.
Firstly, is there a reason this was changed so that pasting a negative number in either format wouldn't automatically translate to a negative number in the specified display format? Would you be willing to restore this behavior in future releases?
In the mean time, how would I change this myself? Unless I am mistaken, I think the two possible approaches would be to intercept the keystrokes in clientside scripts (looking for a "(" and replacing it with a "-"), or changing ig_edit.js for the control itself.
The latter seems cleanest... I think I see the the issue in the line:
me.isMinus=function(k){return k==this.minus.charCodeAt(0)||k == 45||(k==40&&this.negativePattern.indexOf('(')>=0)||k==12540||k==65293||k==65288;}
which maybe should be changed to:
me.isMinus=function(k){return k==this.minus.charCodeAt(0)||k == 45||k==40||k==12540||k==65293||k==65288;}
But if so, I am having trouble getting the site to see the modified version of the file. I presume it is using the now embedded version of the script. I have tried changing the web.config to use
<infragistics.web styleSetName="IFBlue" styleSetPath="~/ig_res" enableAppStyling="false" javaScriptDirectory="~/ig_common/20111CLR40/Scripts" />
When that didn't seem to have any effect, I tried changing the JavaScriptFileName property of the control directly:
<igtxt:webcurrencyedit id="Webcurrencyedit1" width="140" runat="server" HorizontalAlign="Right" JavaScriptFileName="~/ig_common/20111CLR40/Scripts/ig_edit.js"></igtxt:webcurrencyedit>
Still doesn't seem to be using the right version of the javascript.
Any ideas? Any help would be much appreciated!
Hi tinajanis,
This is an update to let you know that I am testing this issue. I will follow-up with you regarding the status of this support case on Friday.
To do this you can use this code snippet to set the culture so that negative currency values show as -$n as compared to the default representation for negative currency values in parenthesis ($n):
protected void Page_Load(object sender, EventArgs e)
{
System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
ci.NumberFormat.CurrencyNegativePattern = 1;//"-$n";
this.WebCurrency1.Culture = ci;
}
Attached is a simple demo that shows this working with the WebCurrencyEditor.
Please let me know if you need any additional assistance regarding this matter.
Sorry, you misunderstood me. I had no trouble setting the culture to show results in the "-$n" format. The problem is after I do, pasting in a negative number in the "(n)" format shows a positive number.
For example, if I use your code above and then paste "(12.80)" into the WebCurrency1 control, it displays "$12.80" instead of "-$12.80". (Pasting "-12.80" does still properly display "-$12.80".)
The old Framework 2 version of the WebCurrencyEdit control worked regardless of which negative format you pasted in. The Framework 4 version of WebCurrencyEdit and of WebCurrencyEditor do not.
We need to display the minus sign, but accept as pasted input either the minus or the parentheses.
I'm guessing the issue is in ig_edit.js.
I meant "Modifying ig_edit.js no longer works in later versions of IG releases.
Also we have CurrencyNegativePattern set to allow - as in minus sign, but need to allow user to paste either - or () for negative currency.
As of now and as original post says pasting (123.45) will show as 123.45 instead of -123.45.
Modifying no longer works in later version of IG releases.Also Client-Events do not have anything there where I can modify/reformat the values neither.The only option left as I see is to attach events (like onpaste) to underline "<input ...>" HTML using jQuery or other methods, and reformatting values in JavaScript.Is there any-other solutions where I can allow users to paste ($99.99) and make it appear as just -$99.99?Note: setting CurrencyNegativePattern of System.Globalization.CultureInfo.CreateSpecificCulture forces you into one mode or the other, but I need user be able to paste both () and -.
Silly me for suggesting keydown-
With respects to the ig_edit.js file, editing js files or control source code is not supported.
Though I do understand your need to make these changes for customes. So, if you wish to do so, all you should need to do is re-compile the source code. Then you should be fine.
Let me know if you need any additional assistance regarding this matter.
Thanks for the feature request.Unless I am missing something, it doesn't look like the keydown approach is an option. Works for typing, but when pasting I can't seem to see the contents of the paste with the parentheses still included. (The event keycode is the one for the Ctrl-V.)Back to modifying ig_edit.js... Once modified, how do I get the app to use the modification instead of the versions embedded in the DLLs? I tried two approaches already as mentioned in the initial post, but neither seemed to work.1) Setting javaScriptDirectory in the web.config. Got errors for infragistics CSOM javascript calls (of ours) being undefined. Either the Infragistics javascript files weren't found, or they were loaded after other javascript on the pages, wen it was too late. (I'm not sure which.)2) Setting JavaScriptFileName for the individual webcurrencyedit/webcurrencyeditor controls. Saw no effect even when I made a change that that should have been obvious. (Setting window.status.) Presume the embedded js files were still being used.I'll keep looking at this off and on, but again... any help is appreciated.