RadTextBox Prevent OnValueChanged

3 posts, 1 answers
  1. Harry Kable
    Harry Kable avatar
    19 posts
    Member since:
    Jan 2010

    Posted 22 Apr 2010 Link to this post

    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. Answer
    Dimo
    Admin
    Dimo avatar
    8482 posts

    Posted 26 Apr 2010 Link to this post

    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.
  3. Harry Kable
    Harry Kable avatar
    19 posts
    Member since:
    Jan 2010

    Posted 26 Apr 2010 Link to this post

    Thanks again Dimo

    I thought you might say that. I have implemented something similar and it works.
Back to Top