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

R

Rob

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.
 
R

Rob

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.
 
R

Rob

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.
 
M

Misbah Arefin

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top