Text box losing most recent Text value

K

Ken McCrory

It's me and my registration page again. I have a subroutine that calculates
the total fees the registrant will incur and puts it in a textbox (not a
label because it has to be passed to another page).

txtTotalFees.Text = Format(dblTotalFees, "Currency")

The subroutine works fine IF I call it from PageLoad, or I assign it to a
button for recalculating the total fees, or the user clicks the Reset
button, or if they click a control that has AutoPostback set to true.
Basically anything that loads or postbacks the page.

BUT...When it comes time to submit the page and go to the next page I have
this code:

If IsValid Then
CalcFees() 'recalcs fees and updates textbox
Server.Transfer("Confirmation.aspx", True)
End If

When the user gets to the next page I put the total fees in another textbox.
EXCEPT it isn't updated to most recent total. I know because I can comment
out the "Server.Transfer" so that it stays at the registration page AND THE
CORRECT TOTAL IS DISPLAYED!?!?!

What is it about the Server.Transfer that "forgets" what the value of the
textbox should be?

Ken "BiggMakk" McCrory
 
S

sze

Hi Ken

Try this:
Server.Transfer("Confirmation.aspx", True)
This sets the parameter preserveForm to true, hence preserving any
variables still available.

You can then retrieve the value from your previous page on the
Confirmation.aspx page by using Request.Form("totalFees")

Hope that helps :)
sze
 
K

Ken McCrory

Thanks for the try but I am already using the True to preserve variables.
(See original post. It's there.)

Ken "BiggMakk" McCrory
 
K

Ken McCrory

I solved this by using SmartNavigation and turning on Autopostback for every
control that can affect the total fees. Before someone says SmartNav doesn't
work in browsers other than IE, you're right. Someone else in a different
post of mine pointed out Smart Scroller by Strength Technologies at this web
site:

http://www.strengthtechnologies.com/scroll/Download.aspx

It works even in Firefox.

Now the Total fees gets updated before the user hits the Submit button and
the correct value gets passed to the next page. It also removes the need for
the manual "Recalculate Fees" button that I had on the page.
 

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

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top