I have some Numeric Textboxes where I am using the OnValueChanging client event to do some validation and when I utilize the eventArgs.set_cancel(true) function, the value is reverted back to the old value, however the currency format is lost when I exit the field. If I reenter the field and exit again, the dollar sign will display properly.
Here is a sample of the script:
function
onValueChanging(sender, eventArgs) {
var
value = eventArgs.get_newValue();
var
txtTest = $find(
"<%= txtTest.ClientID %>"
);
if
((value < sender.get_minValue()) || (value > txtTest.get_value())) {
alert(
'Value must be a non-negative number and cannot exceed txtTest'
);
eventArgs.set_cancel(
true
);
}
}