Note that there are some explanatory texts on larger screens.

plurals
  1. POWell performing method to auto-save and re-populate large ASP.NET form
    text
    copied!<p>My question is about a high performance way to implement auto-saving in an ASP.NET 4.0 WebForms app.</p> <p><strong>I've read a lot on using the various jQuery autosave plugins but they all seem to be best used for minimal input elements. And I haven't found a solution that will populate the ASP.NET form again when the user returns to the form.</strong></p> <p>I have a FormView with a lot of elements, and a nested listview and formview. Using LinqDataSource to populate the FormView and its children.</p> <p>Webserver is IIS 7. DB is SQL Server via Linq to SQL and I have access to MSMQ or any other server components required.</p> <p>I have implemented auto-saving using an UpdatePanel with form elements set to AutoPostBack, and a bit of custom javascript to force async requests to be sequential. This is to avoid concurrency errors in Linq to SQL. Each UpdatePanel async post back saves the entire form to a draft table in SQL Server. It's not very elegant but it does work - slowly!</p> <p>The problem is that the round trip is too slow. This causes form changes made during saving to not be saved, and also the form to jump back to the saved element, if the user has scrolled in the meantime.</p> <p>So I'm now thinking I need to:</p> <ol> <li>Keep the same method, populate the linq entity from the form and save it in MSMQ. I would then pull this out and persist it when the user Submits the form (or maybe on Session End, or when they log in again next time); or</li> <li>Use something like <a href="https://github.com/nervetattoo/jquery-autosave/" rel="nofollow">https://github.com/nervetattoo/jquery-autosave/</a> and save the serialized form data to MSMQ. This would be pretty fast, but the issue is that I am not sure how to put the data back in the ASP.NET form when the user returns to the form in subsequent sessions.</li> </ol> <p>I've also thought about trying to save just the 'sending' form input value on each post back. I could do this in a dictionary and maintain the dictionary in MSMQ.</p> <p>BTW, I can't use the Cache or Session because I have to ensure that the form data is kept even if the user closes the browser. So I need something more robust.</p> <p>Very interested in your opinions - all help greatly appreciated!</p> <p>Cheers..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload