Hello,
I want to set value of radNumericTextbox in its “OnValueChanging” Client event.
But in OnValueChanging event, I am able to get value of radNumericTextbox using sender.get_value(), but sender.set_value(10.123) returns undefined.
So, I tried following method
function OnValueChanging(sender, eventArgs) {
var message;
var target = document.getElementById(sender.get_element().id + '_text');
target.value= 10.123
}
Now, my value is set correctly as 10.123 in radNumericTextBox but without number format.
My radNumericTextbox must have “d” as decimal separator. So it should display 10d123.
Any solutions how set my value with number format in RadNumericTextbox?
Thanks in advance.
6 Answers, 1 is accepted
In order to set a value to the RadNumericTextBox you have to use args.set_newValue("10.123"). More information about OnValueChanging client-side event could be fould here.
All the best,
Kostadin
the Telerik team

Hai Kostadin,
Thanks for the reply.
Your solution worked well if we want to set the new value in the same RadNumericTextbox. But I want to set the new value in another RadNumericTextbox.
If I change a value in first RadNumericTextbox “A” , the new value must be set in second RadNumericTextbox “B”.
For example, my second RadNumericTextbox must display the square of first RadNumericTextBox. If I type 2 in first RadNumerictextbox, the newValue “4” must be set in second RadNumericTextBox.
I have set OnvalueChanging() event of first radNumericTextbox which calculates the square number and sets the new value in second radNumericTextBox.
Function OnValueChanging(
var target = document.getElementById(
target.value= sender.get_value()*sender.get_value();
}
This sets the value without format. How can get the “eventArgs” of second RadNumericTextbox here to display with format?
Thanks in advance.

Try the following code to achieve your scenario.
JS:
<script type=
"text/javascript"
>
function
OnValueChanged(sender, args)
{
var
txt = $find(
"<%= RadNumericTextBox2.ClientID %>"
);
var
sqr = sender.get_value() * sender.get_value();
txt.set_value(sqr);
}
</script>
Thanks,
Princy.

Hello Princy,
Thanks for the reply.
Since my controls are generated programmatically, I cannot use control Id directly. Instead I used $find(sender.get_id().replace()) function as below to find control in which I want to set the new value instead of $find(“<%= controlId.ClientID %>”).
<script type="text/javascript">
function OnValueChanged(sender, args)
{
var txt = $find(sender.get_id().replace("EvaluationColumn_", "Percentage_"));
var sqr = sender.get_value() * sender.get_value();
txt.set_value(sqr);
}
</script>
But I am not able to set value in the second RadNumericTextbox. It gives javascript error “Unable to get value of the property 'toString': object is null or undefined”.
Any solutions how to set the value in the control?
Thanks in advance.
Kavitha
Your approach is right, but I guess you have replaced the wrong IDs. I prepared a sample and attached it to this thread. You can give it a try and see the differences between my project and yours.
All the best,
Kostadin
the Telerik team

Hi Kostadin,
Yes, my approach was correct and it worked well.
It didn’t work before because of another problem. Now I solved the problem and everything is ok.
Thanks for your help.