Auto-save draft documents
While composing large documents, an auto-save feature can be provided. The document can be saved from a RichEdit control on to the backend cache using the AJAX timer control.
<edit:ComposeEditor ID="PostEditor" runat="server" Width="700" Height="500" AutoFocus="true"> <asp:UpdatePanel ID="TimerPanel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="TimerLbl" runat="server" ForeColor="Blue"></asp:Label> <asp:Timer ID="EditorTimer" runat="server" Interval="10000" OnTick="EditorTimer_Tick"> </asp:Timer> </ContentTemplate> </asp:UpdatePanel>
This method can be used with big forms as well. As the UpdatePanel automatically posts the entire viewstate, the state of other controls is available in the postback. The timer event handler that does the saving is shown below:
protected void EditorTimer_Tick(object sender, EventArgs e) { post.Contents = PostEditor.Content; // Save the contents of the editor TimerLbl.Text = String.Format("Draft autosaved at {0}", ISTime.Now.ToLongTimeString()); }
Posted by Vijay on 08-Nov-2010 04:11 PM
Category : ASP.NET AJAX
Category : ASP.NET AJAX


