PC Review


Reply
Thread Tools Rate Thread

How do I keep form variables?

 
 
Mark 123
Guest
Posts: n/a
 
      24th Jan 2005
Hi

I have two forms on one ASPX order page. There are two submit buttons:

1) "Calculate"
2) "Order"

The first form at the top of the page has the Product Name and Quantity as
form fields. The calculate button works out the total order cost and puts it
into a form field when the button is clicked and the page re-loaded (POST
action)

The second form has the customer order details; name, address, telephone
etc.

I have a MSAccess database to store all data, including the price and
quantity. However, whilst the database has the name, address, telephone etc,
the price and quantity are always blank. I am using the Request("Quantity")
syntax for ASP. I have tried to store the value with Session("Quantity") but
that still comes up blank. I don't want to use Cookies.

Any suggestions?

TIA





 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      24th Jan 2005
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


"Mark 123" <(E-Mail Removed)> wrote in message
news:lG0Jd.10945$(E-Mail Removed)...
> Hi
>
> I have two forms on one ASPX order page. There are two submit buttons:
>
> 1) "Calculate"
> 2) "Order"
>
> The first form at the top of the page has the Product Name and Quantity as
> form fields. The calculate button works out the total order cost and puts
> it
> into a form field when the button is clicked and the page re-loaded (POST
> action)
>
> The second form has the customer order details; name, address, telephone
> etc.
>
> I have a MSAccess database to store all data, including the price and
> quantity. However, whilst the database has the name, address, telephone
> etc,
> the price and quantity are always blank. I am using the
> Request("Quantity")
> syntax for ASP. I have tried to store the value with Session("Quantity")
> but
> that still comes up blank. I don't want to use Cookies.
>
> Any suggestions?
>
> TIA
>
>
>
>
>



 
Reply With Quote
 
Mark B
Guest
Posts: n/a
 
      24th Jan 2005
Thanks. I wonder if that will work where instead of progressing on to a
second webpage, the 'next' webpage is just a refresh caused by clicking the
'Calculate' button which does a form POST.



"Steve C. Orr [MVP, MCSD]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Here's a nice, simple way to pass values from one page to another:
> (VB.NET code)
>
> 'Add data to the context object before transferring
> Context.Items("myParameter") = x
> Server.Transfer("WebForm2.aspx")
>
> Then, in WebForm2.aspx:
>
> 'Grab data from the context property
> Dim x as Integer = CType(Context.Items("myParameter"),Integer)
>
> Of course there are a number of ways to pass values from one page to
> another, such as using the querystring, cookies, session,
> context, saving to a temporary table in the database between each page,

etc.
> You'll have to decide which technique is best for your application.
> Here are several good articles on the subject to help you decide.
>

http://msdn.microsoft.com/msdnmag/is...e/default.aspx
>
> http://www.aspalliance.com/kenc/passval.aspx
>
> http://www.dotnetbips.com/displayarticle.aspx?id=79
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
>
> "Mark 123" <(E-Mail Removed)> wrote in message
> news:lG0Jd.10945$(E-Mail Removed)...
> > Hi
> >
> > I have two forms on one ASPX order page. There are two submit buttons:
> >
> > 1) "Calculate"
> > 2) "Order"
> >
> > The first form at the top of the page has the Product Name and Quantity

as
> > form fields. The calculate button works out the total order cost and

puts
> > it
> > into a form field when the button is clicked and the page re-loaded

(POST
> > action)
> >
> > The second form has the customer order details; name, address, telephone
> > etc.
> >
> > I have a MSAccess database to store all data, including the price and
> > quantity. However, whilst the database has the name, address, telephone
> > etc,
> > the price and quantity are always blank. I am using the
> > Request("Quantity")
> > syntax for ASP. I have tried to store the value with Session("Quantity")
> > but
> > that still comes up blank. I don't want to use Cookies.
> >
> > Any suggestions?
> >
> > TIA
> >
> >
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2003 resets form variables during debugging while the form is open Yarik Microsoft Access Forms 2 2nd Sep 2007 02:14 AM
Access 2003 resets form variables during debugging while the form is open Yarik Microsoft Access Form Coding 2 2nd Sep 2007 02:14 AM
Pass multiple variables - form to form =?Utf-8?B?V2F5bmUtSS1N?= Microsoft Frontpage 7 25th Aug 2007 02:40 PM
Move feild entries from form to form using global variables =?Utf-8?B?SmFja0NHVw==?= Microsoft Access 11 14th Nov 2005 05:22 AM
passing variables from form to form Nathan Microsoft Dot NET Framework Forms 0 11th Jul 2003 04:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:19 AM.