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

setFocus() after ajax Postback

1 Answer 91 Views
Editor
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 21 Jan 2009, 02:56 PM
I want to have a timer on the page (inside an update panel) to just tick away every 5 seconds

When the 5 seconds is up, I'd like to postback to the server, and then when it comes back, set the focus back to the editor control

I've gone through a bunch of the examples in the Demo and help pages, but I can't seem to get it to set the darn focus back to the editor...the only way I've been able to do it is with an input button event.

Ideas?

thanks,
Steve

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 23 Jan 2009, 02:35 PM
Hello Steve,

I suggest to try executing the code which sets the focus with a little timeout, e.g as shown below:

       <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
            <ContentTemplate> 
                <asp:Timer ID="timer" runat="server" Interval="5000" OnTick="timer_Tick">  
                </asp:Timer> 
                <telerik:RadEditor runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad">  
                    <Content> 
           Here is sample content!  
                    </Content> 
                </telerik:RadEditor> 
            </ContentTemplate> 
        </asp:UpdatePanel> 
 
        <script type="text/javascript">  
   function OnClientLoad(sender, args)  
   {  
      //set the focus on the the editor  
      setTimeout(function(){  
      sender.setFocus();  
 
      }, 100);   
   }  
    
        </script> 
 

For your convenience I attached my test demo - in case you need further assistance, please modify it in order to replicate your setup, open a new support ticket and send it to us along with detailed explanations and reproduction steps.

Kind regards,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Svetlina Anati
Telerik team
Share this question
or