Client side event *after* text is pasted in to ASP.NET textbox

Discussion in 'ASP .Net Web Controls' started by Rob, Feb 4, 2008.

  1. Rob

    Rob Guest

    Is there a client side event that first after a paste has been carried out
    using the context menu? I'm implementing a word count on a text box and use
    onkeyup to trap key presses. That works a treat and works for Ctrl-V paste
    but I need to trap when the user pastes in text using right-click, paste.

    onmouseup/down appears to fire before the text is pasted thus not updating
    the word count correctly.

    Cheers, Rob.
     
    Rob, Feb 4, 2008
    #1
    1. Advertising

  2. this link lists all the events for a input type=text control
    http://msdn2.microsoft.com/en-us/library/ms535841(VS.85).aspx#

    try onbeforepaste
    http://msdn2.microsoft.com/en-us/library/ms536905(VS.85).aspx

    hope the link helps

    --
    Misbah Arefin



    "Rob" wrote:

    > Is there a client side event that first after a paste has been carried out
    > using the context menu? I'm implementing a word count on a text box and use
    > onkeyup to trap key presses. That works a treat and works for Ctrl-V paste
    > but I need to trap when the user pastes in text using right-click, paste.
    >
    > onmouseup/down appears to fire before the text is pasted thus not updating
    > the word count correctly.
    >
    > Cheers, Rob.
    >
    >
    >
     
    Misbah Arefin, Feb 4, 2008
    #2
    1. Advertising

  3. Rob

    Rob Guest

    Rob, Feb 4, 2008
    #3
  4. Rob

    Rob Guest

    > Actually onpaste might be more useful as I'm assuming this fires after the
    > paste has happened, otherwise there would not be an "OnBeforePaste" event.


    Darn! It doesn't - adding a call to UpdateWordCount() doesn't work as it
    appears that the text still hasn't been pasted when the onpaste event
    occurs.

    Cheers, Rob.
     
    Rob, Feb 4, 2008
    #4
  5. Rob

    Rob Guest

    > Darn! It doesn't - adding a call to UpdateWordCount() doesn't work as it
    > appears that the text still hasn't been pasted when the onpaste event
    > occurs.


    I've got a workaround that'll do for now. Instead of calling
    UpdateWordCount() directly, I do:

    setTimeout('UpdateWordCount()', 1000)

    which causes the word count to update a second after the user has pasted it
    in, which is enough for the paste to complete.

    Cheers, Rob.
     
    Rob, Feb 4, 2008
    #5
  6. oh yeah right; onpaste (not onbeforepaste) guess I should have had read your
    question more carefully :)
    btw you could also try onchange which will fire after any change is made to
    the textbox even a paste via the context menu

    --
    Misbah Arefin


    "Rob" <> wrote in message
    news:9YLpj.986$...
    >> Darn! It doesn't - adding a call to UpdateWordCount() doesn't work as it
    >> appears that the text still hasn't been pasted when the onpaste event
    >> occurs.

    >
    > I've got a workaround that'll do for now. Instead of calling
    > UpdateWordCount() directly, I do:
    >
    > setTimeout('UpdateWordCount()', 1000)
    >
    > which causes the word count to update a second after the user has pasted
    > it in, which is enough for the paste to complete.
    >
    > Cheers, Rob.
    >
     
    Misbah Arefin, Feb 5, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Feng
    Replies:
    1
    Views:
    7,970
  2. Dhara
    Replies:
    1
    Views:
    1,165
  3. Boss302
    Replies:
    0
    Views:
    1,060
    Boss302
    Nov 21, 2006
  4. Guest

    Fire server side event before client side event

    Guest, Mar 17, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    597
    Ken Cox [Microsoft MVP]
    Mar 18, 2005
  5. Kermit Piper
    Replies:
    1
    Views:
    147
    Thomas 'PointedEars' Lahn
    Mar 12, 2006
Loading...

Share This Page