Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
415 views
in Technique[技术] by (71.8m points)

c# - ASP.NET Forms autosave

We have an internal asp.net forms app where one page is essentially a WYSIWYG editor that users enter 3-5 paragraph reports into. What are the best options for an autosave feature with the minimum amount of user-interrupt? I don't want to force a postback every five minutes or so unless I have to, but rather maybe some type of client-side check every time the text changes and compare that to the last time the information has been submitted, and go from there?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is a perfect task which could be solved by using AJAX. You could set some sort of timer to run that starts as soon as the user makes a change client-side and have it then do an asynchronous call client-side back to your server to send the contents of the WYSIWYG box. You could then disable the timer until the user starts editing again to avoid un-needed asynchronous calls.

This would certainly avoid interrupting the user with a postback.

There are lots of ways to do this but the following MSDN link would be a good start:

http://msdn.microsoft.com/en-us/library/bb398785.aspx

Essentially, that gives you an overview but the main bit you need to focus on is exposing web-services to JavaScript:

http://msdn.microsoft.com/en-us/library/bb398998.aspx


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...