Events to control HTMLEditor in ASP.NET AJAX Control Toolkit?

I am using HTMLEditor control from ASP.NET AJAX Control Toolkit. Works great. I would like to hook up a keyup (onkeyup) event so that I can do things like display (approximate) the number of times the number of characters runs in the editor.

I figured out that the editor is ultimately a textarea element inside an iframe element. I can add events to a textbox using the syntax like this:

$addHandler($get("Editor1_ctl02_ctl01"), "keyup", displayCharCount);

      

This line works without error. However, the reference method (displayCharCount) is never called. I don't know if this is a textarea function residing in an iframe or if the control is already eating the event or what.

FWIW, this works as expected on a simple page that uses a regular textarea element.

Any ideas?

0


a source to share


1 answer


There is a text box, but it is hidden. This way your event handler can be registered, but "keyup" never triggers the hidden control. You might want to try another event like onchange or ontextchange (or whatever its name is).

The editor window you see is actually an html document in the iframe itself. The html document is in edit mode, so it looks like a text box. The hidden textbox is just used as a smart place to store the html markup, so when the form is submitted, the html markup is sent to the server.



It's a tricky way to make it all work ... but it works!

0


a source







All Articles