This is a migrated thread and some comments may be shown as answers.

OnClientLoad Event is not defined

1 Answer 203 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ritika
Top achievements
Rank 1
Ritika asked on 01 Nov 2012, 05:15 AM
Hi,

I am trying to attach onkeypress eventhandler in onclientload of radeditor. I want to check a checkbox as soon as any alphabet is entered in radeditor.

<telerik:RadEditor runat="server" ID="RadEditor1" ContentAreaMode="Div" EditModes="Design" 
                                 OnClientLoad="OnClientLoad">

<script type="text/javascript">
     function OnClientLoad(editor) {
            editor.AttachEventHandler("onkeypress", function (e) {
                $('#<%=chktext.ClientID %>').attr('checked', true);
            });
        }
</script>

i get a javascript error which says UnCaught Reference Error:OnClientLoad is not defined. What should i do?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 01 Nov 2012, 10:23 AM
Hi Ritika,

Try the following code snippet to achieve your scenario.

ASPX:
<telerik:RadEditor runat="server" ID="RadEditor1" ContentAreaMode="Div" EditModes="Design" OnClientLoad="OnClientLoad">
</telerik:RadEditor>
<asp:CheckBox ID="chktext" runat="server" />

JS:
<script type="text/javascript">
    function OnClientLoad(editor) {
        editor.attachEventHandler("onkeypress", function (e) {
            $('#<%=chktext.ClientID %>').attr('checked', true);
        });
    }
</script>

Hope this helps.

Regards,
Shinu.
Tags
Editor
Asked by
Ritika
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or