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

Passing Parameters to OnClientLoad event of RadEditor

1 Answer 108 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Navnit
Top achievements
Rank 1
Navnit asked on 29 Jan 2013, 12:22 PM
Hi,

I am having a requirement where I need to AutoSave RadEditor content. Now these RadEditor are present inside Repeater control and they may be more than one RadEditor present inside the control.

I have Implemented AutoSave using OnClientLoad event & RadAjaxManager. But the issue here is that I cannot explicitly pass the RadEditor Primary Key id through which I can Identify that the passed RadEditor text on server Side, Since OnClientLoad event doesnot takes any parameters.

Below is my ASPX Code
<asp:Repeater ID="Repeater1" runat="server">
    <ItemTemplate>
        <table>
            <tr>
                <td>
                    <b><asp:Label ID="lblID" Text='<%# DataBinder.Eval(Container.DataItem, "ID")%>' runat="server"
                            Visible="false"></asp:Label></b>
                    <telerik:RadEditor ID="RadEditor1" Content='<%# Bind("Description") %>' runat="server"
                        OnClientLoad="OnClientLoad">
                        <Languages>
                            <telerik:SpellCheckerLanguage Code="en-US" Title="English" />
                        </Languages>
                    </telerik:RadEditor>
                </td>
            </tr>
        </table>
    </ItemTemplate>

and my JavaScript Code
var timer = null;
var radE = null;
 
function OnClientLoad(editor, args) {
                radE = editor;
                editor.add_spellCheckLoaded(function () {
                    var spell = editor.get_ajaxSpellCheck();
                    spell.add_spellCheckStart(function (editor, args) {
                        stopTimer();
                    });
 
                    spell.add_spellCheckEnd(function (editor, args) {
                        startTimer();
                    });
                }
            );
                editor.attachEventHandler("onkeyup", function (e) {
                    stopTimer();
                    startTimer();
                });
            }
 
function stopTimer() {
                if (timer != undefined || timer != null) clearTimeout(timer);
            }
 
            function startTimer() {
                timer = setTimeout("autoSave()", 6000);
            }
 
function autoSave() {
                var content = radE.get_html(true);
                var ajaxManager = $find("<%= RadAjaxManager.ClientID %>");
                ajaxManager.ajaxRequest(content);
               
            }

Now as OnClientLoad doesn't takes any parameter on server side I cannot identify which Radeditor content is being edited.
 Can you please suggest me any way by which I can pass Label lblID to OnCLientLoad Event of Radeditor.

1 Answer, 1 is accepted

Sort by
0
Navnit
Top achievements
Rank 1
answered on 30 Jan 2013, 11:15 AM
Hi,

I am able to find the workaround for the above. Thanks.
Tags
Editor
Asked by
Navnit
Top achievements
Rank 1
Answers by
Navnit
Top achievements
Rank 1
Share this question
or