This is a migrated thread and some comments may be shown as answers.
Raise OnValueChanged event in code
2 Answers 63 Views
This is a migrated thread and some comments may be shown as answers.
dingjing
Top achievements
Rank 2
dingjing asked on 06 Apr 2008, 04:16 PM
If I modify a RadTextBox's value using its set_value() method, will its OnValueChanged event be raised?

2 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 07 Apr 2008, 02:25 PM
Hi dingjing,

Yes, the OnValueChanged event will be raised in this case. The event occurs immediately after the control is been updated.

Best regards,
Maria Ilieva
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Steele
Top achievements
Rank 1
answered on 19 Oct 2008, 04:58 AM
How do I prevent this behavior?

I have a control that relies on OnValueChanged Client side event to fire a request to my server.
When I receive data back from the server, I replace the text in the RadTextBox with a value received from the server and the event fires again, regetting the data from the server, then refiring the event... etc.
 I have tried to suppress the behavior as follows, which it does, but then the control goes into a crazy loop and I cannot even enter text into it.

this code is called from the valuechanged event handler:

//prevent valuechanged from firing again...
var si = $find("<%= SearchInput.ClientID %>");
si.remove_valueChanged(SearchInput_valuechanged);
si.set_value(requestor.RequestorID.toUpperCase());
si.add_valueChanged(SearchInput_valuechanged);

so I get caught in this viscious loop which doesn't make any sense, now the textbox will not allow any input and it does not fire the event.

for example, after the above code runs, the next time I try to enter text in the RadTextBox it accepts one character input then resets it to the previous text and does not fire the valuechanged event.  I have only tested this in IE7, but this should not be right, the above code should work, unless it is resetting the event handler incorrectly.

I am using 2008 Q2 SP2.

Thanks,

Steele Price
Tags
Input
Asked by
dingjing
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Steele
Top achievements
Rank 1
Share this question
or