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

RadTextBox Prevent OnValueChanged

2 Answers 143 Views
Input
This is a migrated thread and some comments may be shown as answers.
Harry Kable
Top achievements
Rank 1
Harry Kable asked on 23 Apr 2010, 03:47 AM
Hi
I have an ASP.NET form containing a set on RadTextBoxes each with an OnValueChanged event handler defined (these create different AJAX calls required for user input validation).
I am populating the form with pre-validated data using javascript in an AJAX callback function.
The OnValueChanged events appear to be firing as each RadTextBox is populated. Is this normal behaviour?
I thought a RadTextBox needed to lose focus before its OnValueChanged event fired. Perhaps the $find() function used to retrieve a reference to a RadTextBox in order to set its value also sets focus.
Is there a better way to populate the text boxes without firing the event?

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 26 Apr 2010, 08:02 AM
Hi Harry Kable,

> "The OnValueChanged events appear to be firing as each RadTextBox is populated. Is this normal behaviour?"

Yes.


> "I thought a RadTextBox needed to lose focus before its OnValueChanged event fired."

This is when you type the value manually.


In your case I suggest you to use some global Javascript variable as a flag and check its value in the ValueChanged handlers. You will change the flag's value after populating all textboxes and then the ValueChanged handlers will start working only when needed.


Best wishes,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Harry Kable
Top achievements
Rank 1
answered on 26 Apr 2010, 08:05 AM
Thanks again Dimo

I thought you might say that. I have implemented something similar and it works.
Tags
Input
Asked by
Harry Kable
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Harry Kable
Top achievements
Rank 1
Share this question
or