RadEditor for ASP.NET

AttachEventHandler Send comments on this topic.
Client-side API Reference > Methods > AttachEventHandler

Glossary Item Box

Attaches an event to its handler.

function AttachEventHandler (event, eventHandler)

event string The event name.
eventHandler function

You can attach to the traditional browser event such as:

  • mouseover,
  • keydown,
  • onkeyup,
  • onkeydown,
  • onclick,

etc.

In addition, you can also attach to the following specific RadEditor events related to your project:

  • RADEVENT_MODE_CHANGED event - signals that the editor mode is about to be changed (from design to html to preview mode)
  • RADEVENT_SEL_CHANGED event - signals that  the selection within the editor content area has changed
  • RADEVENT_SIZE_CHANGED event - signals that the editor's size has been changed


Example

You can detect the editor content change by handling the RADEVENT_SEL_CHANGED event, i.e:

JavaScript Copy Code
<script type="text/javascript">
function OnClientLoad(editor)
{
  
editor.AttachEventHandler ("RADEVENT_SEL_CHANGED", function (e)
  {
     alert(
"RADEVENT_SEL_CHANGED")
  }
 );
}
</script>
ASPX/ASCX Copy Code
<rad:RadEditor
  
Editable="true"
  
id="RadEditor1"
  
OnClientLoad="OnClientLoad"
  
Runat="server">
</
rad:RadEditor>