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

RadEditor loses focus while doing an AutoSave

1 Answer 142 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Muhammad Akhtar
Top achievements
Rank 1
Muhammad Akhtar asked on 25 May 2010, 06:07 PM

I know this has been posted with even replies from Mods 

http://www.telerik.com/community/forums/aspnet-ajax/editor/radeditor-lost-focus-after-autosave.aspx

But I dont have my Telerik Control inside the Update panel but it still refresh the conrol and loses its focus. Is there a way to do a AutoSave without refreshing directly from ClientSide?




<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Control_RichEdit.ascx.cs" Inherits="Common_Control_RichEdit" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
 
<telerik:RadEditor ID="RadEditor1" runat="server" ToolsFile="../TelerikRichEditControl/ToolsFile.xml" Skin="Web20" EditModes="Design" > 
   
 
</telerik:RadEditor> 
<asp:Timer ID="Timer1" runat="server" Interval="500000" OnTick="Timer1_Tick">  
        </asp:Timer> 
                <br /> 
        <br /> 
        <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">  
            <Triggers> 
                <asp:AsyncPostBackTrigger ControlID="Timer1" /> 
            </Triggers> 
        </asp:UpdatePanel> 
          
          
<script type="text/javascript">   
        function OnClientLoad(sender, args)  
        {  
            var timer = $find("<%=Timer1.ClientID %>");  
              
              
            startCounter();  
          
            //Attach to the spellCheckLoaded event as the spell itself is loaded with AJAX  
            sender.add_spellCheckLoaded(function()  
                {  
                    var spell = sender.get_ajaxSpellCheck();  
                                              
                    spell.add_spellCheckStart(function(sender, args)  
                    {   
                        timer._stopTimer();  
                          
                        //Stop counter  
                        stopCounter();  
                    });  
                                  
                    spell.add_spellCheckEnd(function(sender, args)  
                    {  
                        //Restart the timer;   
                        timer._startTimer();  
                          
                        //Restart counter  
                        startCounter();  
                    });  
                }   
            );  
        }  
 
        var strText = document.getElementById('RadEditor1');  
 
        alert(strText);  
        //======================================== UI update for the remaining seconds =======================================//  
        var initialSeconds = 15;  
        var currentSeconds = initialSeconds;  
        var interval = null;  
        function startCounter()  
        {  
            if (!interval)  
            {  
                 currentSeconds = initialSeconds;  
                 interval = window.setInterval(function()  
                 {   
                    if (currentSeconds > 0)  
                    {  
                        currentSeconds--;  
                    }  
                    else  
                    {  
                        currentSeconds = initialSeconds;  
                    }  
                      
                    var span = document.getElementById("remainingSeconds");   
                    span.innerHTML = currentSeconds;  
                      
                 }, 1000);  
            }   
        }  
                          
        function stopCounter()  
        {  
            if (interval) window.clearInterval(interval);  
            interval = null;  
        }  
          
        //===============================================================================================================//  
    </script> 
 
     
Server side
using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
 
public partial class Common_Control_RichEdit : System.Web.UI.UserControl  
{  
    public string Text  
    {  
        get { return RadEditor1.Text; }  
        set { RadEditor1.Text = value; }  
    }  
    protected void Page_Load(object sender, EventArgs e)  
    {  
 
    }  
    protected void Timer1_Tick(object sender, EventArgs e)  
    {  
        //lbl1.Text = RadEditor1.Content;  
        this.RadEditor1.Focus();  
    }  
 
}  
 

Could you please explain me about the ClientSide Save? without refreshing the control ( Like Gmail, Yahoo Mail does?)

Thanks
Roomi

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 26 May 2010, 04:53 PM
Hello Muhammad,

I was unable to reproduce the lose focus problem with the example provided in the following forum post:
http://www.telerik.com/community/forums/aspnet-ajax/editor/radeditor-lost-focus-after-autosave.aspx
You can see my test in the attached video at http://screencast.com/t/ODdiYWVlODUt. For your convenience I have also attached the project files along with the Telerik.Web.UI.dll - so that you can test this scenario once again on your side.

I think that GMail and Yahoo use web service to update their content areas.

Sincerely yours,
Rumen
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.
Tags
Editor
Asked by
Muhammad Akhtar
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or