Hey
I need some clarifications about your NumericUpDown Box
THX for every tip you have for me
The javascript code you attached calls select() when a valid digit is typed:
if ('+-1234567890'.indexOf(key) == -1) e.stop(); <--- this is when an invalid digit is pressed. else this.select(); <--- select() is not a valid function. "this" is a widget not an element.
should be:
if ('+-1234567890'.indexOf(key) == -1){ e.stop(); this.selectAllText(); } HTH
Hey
First of all: Thx for your solution. I extended it for my needs, but having trouble with a specific behaivour.
I changed the code from your sample with two little things to show you the problem. Not sure, if it is a bug or not.
I attached in JavaScript, that when a “wrong” value is inserted, then the whole text should be selected.
And in code behind: when the control gets entered, then also the whole text should be selected.
Now, when I enter the textbox, everything gets selected as expected. When the first input is a “wrong” (e.g. “a”) and then a correct value is used, then it get’s attached at the end and not overwritten:
The starting value = 0,00
When I enter a wrong and then 1 it becomes => 0,001 and it does not overwrite the 0,00 to => 1 as expected.
Could you please check, if this is a bug or a problem by my code!?
THX a lot – Have a nice start of the week
Harald
Just checked in Winforms and I can’t see any way to format a NumericUpDown. In Winforms you can also type a decimal value when the Decimals property is set to zero, the result will be a number without decimals, which is correct. Wisej does exactly the same. NumericUpDown cannot be formatted using custom strings in Winforms and in Wisej – the text has to be parsed into a valid number on the client.
You can format a data bound TextBox control (like in Winforms) and use “p” for percentages or “+#0.00;-#0.00” to show +/-.
With Wisej you can also attach a javascript event to stop “.” or “,” from being typed and force only numeric characters. And you can show a custom +/- button inside the field. You need to create a custom control.
I attached some sample code you can use and adapt to your requirements.
Please login first to submit.