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

radeditor focus doesn't work

2 Answers 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
priya nallaperumal
Top achievements
Rank 1
priya nallaperumal asked on 16 Feb 2010, 12:42 PM

<telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="ClientLoad"  ContentFilters="MakeUrlsAbsolute" >
        <Content></Content>
        </telerik:RadEditor>

C#:
protected void sendbtn_Click(object sender, EventArgs e)
 {   
       RadEditor1.Focus();
}

radeditor doesn't set focus on button click.. function.
i tried client side also. but $find("<%=RadEditor1.ClientID%>") is null.. not an object error is occur...
anyone please help me..
thx.

2 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 16 Feb 2010, 02:21 PM
Hello priya,

In order to get the desired result you should use client-side code as shown below:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadEditorPrizes.aspx.cs"
    Inherits="Default2" %>
  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadEditor runat="server" ID="RadEditor1">
            <Content>  
           Here is sample content!   
            </Content>
        </telerik:RadEditor>
  
        <script type="text/javascript">   
   function setFocus(sender, args)   
   {   
      //set the focus on the the editor 
      var editor = $find("<%= RadEditor1.ClientID%>");  
      editor.setFocus();   
   }   
       
        </script>
  
        <asp:Button ID="btn" runat="server" Text="Set Focus" OnClientClick="setFocus();return false;" />
    </form>
</body>
</html>



Best wishes,
Svetlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
robertw102
Top achievements
Rank 1
answered on 16 Feb 2010, 02:25 PM
I believe this help article should be of use, it tells you how to set the focus to the RadEditor on a button click.

Tags
General Discussions
Asked by
priya nallaperumal
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
robertw102
Top achievements
Rank 1
Share this question
or