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

About Rad Editor

4 Answers 32 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Gaurish
Top achievements
Rank 1
Gaurish asked on 10 Oct 2008, 10:20 AM

i have page with a  New Button for Inserting Records  .on that button i am showing visibility  of Textbox , rad editor, when i click on the New Button, the text box , rad editor will be visible. i want to set focus in Textbox..but problem is,  when rad editor displpay in a page,  text box focus is lost.  can you give me the solutions for that.?



4 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 10 Oct 2008, 03:28 PM
Hi Rohan,

You need to set the focus to the textbox in the OnClientLoad event of RadEditor with a small delay. For that purpose you can use the setTimeout javascript method, e.g.

function OnClientLoad()
{
   setTimeout(function()
   {
      txt1.focus(); //set the focus to the textbox with id txt1
   }, 100);
}

If this does not help put the setTimeout(function() {  txt1.focus(); }, 100); function in the onclick event of the New Button.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Gaurish
Top achievements
Rank 1
answered on 11 Oct 2008, 05:04 AM
hi  ,

i have tried that but it giving error that , Exception while executing Client event
OnClientLoad  Error: object expected. i have given the object .


0
Rumen
Telerik team
answered on 13 Oct 2008, 06:00 AM
Hi Rohan,

You should get a reference to the textbox before setting the focus to it. For example if the id of the textbox is txt1, then you can get a reference to it with var txt1 = $get("<%=txt1.ClientID%>");, e.g.

<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
<telerik:radeditor runat="server" OnClientLoad="OnClientLoad" ID="RadEditor1"></telerik:radeditor>

<script type="text/javascript">
function OnClientLoad()
{
   setTimeout(function()
   {
      var txt1 = $get("<%=txt1.ClientID%>");
      txt1.focus(); //set the focus to the textbox with id txt1
   }, 100);
}
</script>


For your convenience, I have attached my test page.


Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Gaurish
Top achievements
Rank 1
answered on 13 Oct 2008, 11:44 AM
hi Rumen.

Thank you very much . now its working .


Tags
Editor
Asked by
Gaurish
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Gaurish
Top achievements
Rank 1
Share this question
or