auto saving a draft

// jquery
setInterval(function() {
    $('#theFormToSave').ajaxSubmit({
        url    : 'SaveDraft',
        success: function (data, textStatus) {
            if (data.success) {
                alert('form successfully saved');
            }
        }
    });
}, 30000);


// action
public ActionResult SaveDraft(FormCollection form)
{
    // TODO: Save the form values and return a JSON result
    // to indicate if the save went succesfully
    return Json(new { success = true });
}

You can try using AJAX to achieve this. Please have a go at the threads below how to achieve this.

http://www.vijaykodali.com/Blog/post/2009/11/23/Auto-save-Aspnet-web-form-values-Asynchronously.aspx

or have a look at this for AutoSaving example https://skydrive.live.com/?cid=2F22272220E37707&id=2F22272220E37707%21103

or use jQuery as following

https://github.com/kflorence/jquery-autosave

Hope this helps.

No comment

Bir cevap yazın

E-posta hesabınız yayımlanmayacak.