I set the MinValue to 1 and the DecimalDigits to zero as shown below.
The following was posted as a solution to work with both FireFox and IE but I can't get it to work on either
I would like to find a solution to this, but in the mean time I am swapping the RadNumericTextBox for the RadMaskedTextBox.
<
telerik:RadNumericTextBox
ID
=
"MyRadNumericTextBox"
runat
=
"server"
Culture
=
"English (United States)"
DbValueFactor
=
"1"
MinValue
=
"1"
>
<
NumberFormat
ZeroPattern
=
"n"
DecimalDigits
=
"0"
></
NumberFormat
>
</
telerik:RadNumericTextBox
>
Steps to Reproduce
Add the above RadNumericTextBox to a Webform.
Enter a negative number. When the RadNumericTextbox loses focus, the value entered automatically changes to the value set as MinValue.
Enter a number containing a decimal. When the RadNumericTextbox loses focus, the value entered is automatically rounded to the nearest integer.
I did find the following java snippets in your forum that are suppose to block the user from entering decimals and negative symbols but neither of them work on both IE and FireFox.
Delete key does not work in FireFox
<script type=
"text/javascript"
>
function
OnKeyPress(sender, args) {
var
keycode = args.get_keyCode()
if
(keycode == 46 || keycode == 110) {
args.set_cancel(
true
);
}
}
</script>
The following was posted as a solution to work with both FireFox and IE but I can't get it to work on either
<script type=
"text/javascript"
>
function
OnKeyPress(sender, args) {
var
keyCharCode = args.get_domEvent().rawEvent.charCode;
if
(keyCharCode == sender.get_numberFormat().DecimalSeparator.charCodeAt() || keyCharCode == sender.get_numberFormat().NegativeSign.charCodeAt()) {
args.set_cancel(
true
);
}
}
</script>
I would like to find a solution to this, but in the mean time I am swapping the RadNumericTextBox for the RadMaskedTextBox.