Have ASP page call save function anytime the user tries to navigate away from page

Posted by Breander on Stack Overflow See other posts from Stack Overflow or by Breander
Published on 2010-06-09T00:25:29Z Indexed on 2010/06/09 0:32 UTC
Read the original article Hit count: 193

Filed under:
|
|
|

What I have is an input page with a bunch of dynamically created textboxes for the user to input data. The textboxes are dynamically created because the number that are needed are not known until the user selects some options on the page. So what I need to have happen is if the user tries to either

A) navigate away from the page or

B) select different options bringing up new textboxes.

Anything the user may have typed into the textboxes needs to automatically be saved to the database. Like they clicked on the save button on the page. This doesn't sound like a vary smart way to do things or even an easy way to do things but this is the requirement I have been given. No message just save to the database. I have looked into things like onbeforepageunload javascript but that mostly tries to stop the user from navigating away I can't call any code behind code from it. Any help is appreciated.

Note : The number of the texboxes with data can be any where between 20 and 500. Yes very crazy but not my idea.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about database