Looking for way to handle Paste into RadTextBox

4 posts, 1 answers
  1. Stephen
    Stephen avatar
    2 posts
    Member since:
    Oct 2011

    Posted 24 Oct 2011 Link to this post


    I have an ASP.Net Framework 4 application on Windows 7, using C# for the backend coding, that I need to be able to trigger off of a paste event in a RadTextBox control.

    Scenario is there are two text box controls. If the user enters text into one text box, the other text box needs to be cleared. I have handled this for the case when the user types new text into either of the text boxes, but that solution (using the ClientEvents-OnKeyPress event handler) does not work for a paste operation.

    Is there a solution to this that I have not found? If so, any assistance would be appreciated.



    - ASP.Net Framework 4
    - Windows 7 SP 1
    - IE 9.0.8112.16421
    - Telerik WebUI VSExtensions 2011.02.712.0
    - Preferred Programing Language: C#
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 25 Oct 2011 Link to this post

    Hello Stephen,

    Wouldn't handling the OnValueChanged event work for you? This event should be raised regardless of how the text is entered into the RadTextBox.

    I hope that helps.
  3. DevCraft R3 2016 release webinar banner
  4. Stephen
    Stephen avatar
    2 posts
    Member since:
    Oct 2011

    Posted 25 Oct 2011 Link to this post

    Unfortunately, no, it doesn't work that way.

    Here is a snippet from the online documentation about the OnValueChanged event handling:

    "The event occurs immediately after the control loses focus and its value has been updated, but before the server-side TextChanged event."

    This is what I have in place, but until the text box loses focus for any reason the event is not triggered to clear out the other text box.

    Thanks for the suggestion though.

  5. Answer
    Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 27 Oct 2011 Link to this post

    Hi Stephen,

    You could  try implementing a solution similar to the demo here:


    You can subscribe to onpaste like this:
    < telerik:RadTextBox onpaste="OnPaste()" />
    < script type="text/javascript">
     function OnPaste()
     // .........
    < /script>

    All the best,
    Maria Ilieva
    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
Back to Top