Update textbox value for auto-save

K

kurt

Hi all,

I have something that has me stumped. I have a webform that has several
text boxes. Each of these boxes has the textchanged set so when the
user enters text and leaves the textbox, it runs through and updates
the table with the changed text....which is fine.

But, these users do enter a substantial amount of information in these
textboxes and at times get sidetracked. Sometimes, they come back later
to see the session expired and they can no longer save the information
they entered in the textbox (in this case, they stayed in the same
textbox and textchanged didn't happen). I don't want to keep the
sessions running for a rediculous amount of time for a variety of
reasons, so it does timeout within a reasonable period.

What I would like to do is a type of 'autosave' where it gets sent to
the sub that saves the text and updates the table.

However, when when I try to send it to the Save sub and update through
code...like say from a timer a minute before the session expiration,
the value of the textboxes do not contain any added or changed text. If
I check the value of Text1.text, it will contain 'pre-changed' text.
But, if the user was to click a Save button, the actual text that is
showing in the textbox will be saved. So that way it actually grabs the
current text in the textbox.

Is there a way to update text1.text (or any textbox) to what actually
is entered in the textbox so it can be autosaved? I don't think there
would be a problem in a Windows form, but I'm not using that. I've
tried several things like trying to send it back through Page_Load and
the like, but it's still being stubborn. Is this possible? Thanks for
any help!!!


Kurt
 
L

Lucas Tam

What I would like to do is a type of 'autosave' where it gets sent to
the sub that saves the text and updates the table.

In ASP.NET 2.0 you could use client-side postbacks for this. For ASP.NET
1.1, you can use Dart's live controls or AshleyIT's Javascript Remoting.

Here's a .NET implementation of AshleyIT's Javascript remoting:

http://www.thycotic.com/dotnet_remotescripting.html

Basically what you do is set a Javascript timer on the client side to
postback information in the background to save. The page will not reload
and the user will not know that the information has been saved - totally
seemless autosave : )
 
K

kurt

Thanks very much for your reply Lucas.

When you mentioned using a JavaScript timer to postback information, do
you have any ideas on one? I've been doing some searching and can't
find anything that looks to do what I need. Thanks again!

Kurt
 
L

Lucas Tam

K

kurt

Lucas,
Thanks a lot for your help. I used a JavaScript timer and the
__doPostBack and it worked great!!


Kurt
 
L

Lucas Tam

Lucas,
Thanks a lot for your help. I used a JavaScript timer and the
__doPostBack and it worked great!!


I guess that would work too :) Might catch your users a bit off guard, but
better than not saving.
 
K

kurt

Yeh, but I'd rather them see something happen than have them wander off
or take a phone call and come back to an expired session after entering
a lot of information. It's happened several times and these folks
aren't the happiest of campers. So yeh, you're right....it's better
than not having it saved! Thanks again Lucas!

Kurt
 
Joined
Oct 16, 2009
Messages
1
Reaction score
0
invisible auto save asp.net form

Hey,

I'm having the exact problem described by Kurt above. I really want to find a way to do an invisible auto-save every so often before the session times out.

I've got code behind to save all the controls to the database. This code now executes successfully based on a keep alive client side script, but unfortunately any changes the user makes to any controls on the form are not saved when this code is called. Just as Kurt describes in his original post, the control.value or control.text values are not updated, even when what is showing in the browser is a new value for the various controls. But if the user manually clicks the Save button, the save code executes and all of the updated control values are accurately represented and saved.

I understand I could force a postback as Kurt apparently did in the end, but I really want to avoid a full postback. And I don't want to use AJAX unless I absolutely have to.

I feel like I'm 99% there and there's some function I need to call across all my controls that would enable their .value or .text values to accurately represent what changes the user has made. Or what about a partial postback that does not cause the page to blink? I have done a good deal of searching and really have not found how to fix this.

I would hate to have to implement the GetCallbackEventReference for every control on my page. I would very much not want to rewrite the entire save routines for every control on the page.

Anyone have ideas on how to implement this?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top