select

Editor / Auto-save demo

Change Skin:
select
Run example in: C# VB.NET
Autosave RadEditor's content every 15 seconds:
   
  
 
 
   



The Saved content will be displayed below:

Example Source Code & Description

Open in a new window
  • Autosave RadEditor's content

    This example demonstrates how to implement autosave functionality using RadEditor and MS AJAX Timer. In the example the editor's content is read on the server in the Timer OnTick event, and fed into a label. In a real world scenario the content would be saved into a database or other temporary storage.

    The Timer is configured to perform an AJAX request every 15 seconds. However, it is not advisable to do so without checking whether the user is using the AJAX SpellCheck at the time of sending the content. While it is in AJAX SpellCheck mode, the editor's content contains additional formatting inserted by the spellchecker to highlight mistaken words. As a result, it is not desireable to save the content while in spellcheck mode.

    RadEditor provides events that are raised when a spellcheck starts and ends. The example demonstrates how to attach to these events, and stops the Timer during spellchecking, and restarts it when the spellcheck is finished.

    <script type="text/javascript"
       
    function OnClientLoad(sender, args) 
        { 
           
    var timer = $find("<%=Timer1.ClientID %>")
            
           
    //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()
    ;
                       
    });
                
                   
    spell.add_spellCheckEnd(
                       
    function(sender, args) 
                        {
                           
    //Restart the timer; 
                           
    timer._startTimer();
                       
    });
               
    } );
           
    }
    </script

Compatible with ASP.NET 2.0, 3.5 AJAX enabled Accessibility Verified!Valid XHTML 1.1! Optimized for Visual Studio 2005, 2008
Copyright 2002-2009 © Telerik. All right reserved  | 
Telerik Inc, 275 Grove Street, 4th Floor, Newton MA 02466