This is a migrated thread and some comments may be shown as answers.

RadNumericTextbox OnValueChanged Client-Event fires twice

2 Answers 145 Views
Input
This is a migrated thread and some comments may be shown as answers.
Tejas
Top achievements
Rank 1
Tejas asked on 24 May 2012, 07:34 PM
Hi Team,

I have RadNumericTextBox on my page with Client-Event OnValueChanged.
I've defined a client-side function to handle the event. Whenever I change value, It fires the event correctly but when try to set the value to textbox using sender.set_value() method it sets the value and fires the event again. Is this the expected behavior for RadNumericTextBox ?
Please note that I display a confirmation message to user which is being displayed twice now, I know we can trick the javascript to display message only once but I dont understand why this event fires twice.
Any clue will be appreciated.

Thanks

Tejas

2 Answers, 1 is accepted

Sort by
0
Accepted
Vasil
Telerik team
answered on 28 May 2012, 11:54 AM
Hello Tejas,

set_value changes the value of the control, so the ValueChanged event should be fired. By design this is the correct behaviour.

You may trick it using code like:
var set_valueCalled = false;
 
function HandleValueChanged(sender, args)
{
    if (!set_valueCalled)
    {
        set_valueCalled = true;
        alert("some alert");
        sender.set_value( "some_new_value");
        set_valueCalled = false;
    
}


Greetings,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Tejas
Top achievements
Rank 1
answered on 29 May 2012, 08:32 PM
Thanks for the reply.


Tags
Input
Asked by
Tejas
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Tejas
Top achievements
Rank 1
Share this question
or