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

[Solved] SetFocus on Editor Content Area

4 Answers 127 Views
Editor
This is a migrated thread and some comments may be shown as answers.
meyammai
Top achievements
Rank 1
meyammai asked on 12 Mar 2008, 04:49 PM
I have radeditor in my user control (MyRadEditor.ascx) and im loading this control in another user control (PrintView). i have written setfocus in the ascx page of MyRadEditor

<

script type="text/javascript">

function SetFocusOnRadEditor(clientId)

{

var editor = $find(clientId); //get a reference to RadEditor client object

editor.setFocus();

//set the focus on the the editor

}

</

script>

 when i place the button in  MyRadEditor and onclick of the button , if i call the script, then its perfect . cursor focussed into the editor content area. but when i call the function on the load of editor, nothing rendered.

any way to call the set focus function when the editor loaded. our project is with DNN

4 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 13 Mar 2008, 03:23 PM
Hi Meyammai,

Try to set the focus using the editor's OnClientLoad event - see the code bellow:

<script type="text/javascript">      
   function SetFocusOnRadEditor(editor, args)      
   {       
       editor.setFocus();      
   }     
</script>    
 
<telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="SetFocusOnRadEditor"></telerik:RadEditor> 

I hope this helps.

Best regards,
George
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
meyammai
Top achievements
Rank 1
answered on 13 Mar 2008, 03:44 PM
Thanks. I tried this function But it doesnt help. I dint get any error and also cursor is not focussed in the editor text area.

Could you pls help
0
George
Telerik team
answered on 14 Mar 2008, 02:08 PM
Hi Meyammai,

Could you please, set a timeout to the SetFocus method - note that, the page lifecycle requires the ASCX to be initialized before the ASPX?

In addition to this, please, find attached my test page.

Kind regards,
George
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
meyammai
Top achievements
Rank 1
answered on 14 Mar 2008, 03:03 PM
Thanks a lot. Works like a magic
Tags
Editor
Asked by
meyammai
Top achievements
Rank 1
Answers by
George
Telerik team
meyammai
Top achievements
Rank 1
Share this question
or