Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PostBack Headaches

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
I have multiple textboxes on a webform containing data from SQL Server. Each textbox has AutoPostBack=True, and each textbox also has a TextChanged event which updates SQL Server whenever users input data.

My users dislike the fact that the page postsback after each & every textbox modification. This webform also contains several button controls which Response.Redirect the users to other pages within the application. I've tried to program logic into these buttons' click events to check for changes in the textboxes before redirection, and if changes exist, update SQL Server. However, if a user makes updates and then just closes their webbrowser, all is lost.

Is there a way that I can program one routine within this webform to take care of all textbox changes without having to postback after each change? Thanks.

--
Regards,
Mike
 
You can ask the user if they want to save the changes before they close the window...

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
If the problem is that they lose the changes because they close the browser, I do not think there is a way to have it save the data prior to shutdown. Frankly, if the user does not realise that closing their browser will erase all of their changes, then the problem (IMHO) is a user-training issue.

I think you've done the best you can by looking for changes in the textboxes when they click the buttons and submitting the updates prior to leaving the page. Trying to submit everytime they make a change would be too much. And there simply isn't a way to prevent a user from shutting the browser down and erasing their changes. I think if they do it a few times, they'll quickly learn not to do it and your problem should be solved. Those who are unable to learn will soon find themselves doing other things.

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
ca8msm, is there a way to determine that the window is being closed and prompt an error message?

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Interesting... Thanks for the knowledge! [thumbsup]

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
It's not a completly foolproof method but in most cases it will do the job quite well.

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Thank you both for your replies/thoughts! That pop-up is definately a valuable resource. Thanks!

--
Regards,
Mike
 
something that i just used as well is a hidden textbox...and for each text box i assign it an onchange javascript event...

when the text changes the text box value gets set to 1...then on a redirect button, if the textbox value = 1, I call the Update sub to update the db...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
How does that help if the user just closes the browser?

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
it doesn't...but it does, if they hit one of the redirect buttons...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Oh OK - it just confused me as the poster said "if a user makes updates and then just closes their webbrowser, all is lost".

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top