Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: adding up values from a textbox


Message #1 by "Joe Ehrenfeld" <joee@v...> on Tue, 28 Aug 2001 12:47:12
In my form I have a column that displays the "quantity to ship" amount. 

It's value is pre-populated from a database. There is never a 0 or empty 

record in the textbox. The user can change the amount to ship. When the 

page is submitted I need to be able to take all the textboxes and add them 

all up to get a total of the amount to be shipped. First question, how can 

I do that? Second, here is the catch, each row has a checkbox with it. I 

only want to be able to add up those rows that have been checked.How can I 

do that?



Thanks!!
Message #2 by "Bailey, Mark" <MBailey@m...> on Tue, 28 Aug 2001 07:59:00 -0400
One possible solution is to use control arrays.



Create a table containing:



chkBox,HiddenInput,Item to Ship,Quantity to Ship



On the submit loop through the controls, for each checked 

chkBox, grab the HiddenInput (probably an ID of somesort),

and update the quantity to ship with the corresponding amount

to ship.







-----Original Message-----

From: Joe Ehrenfeld [mailto:joee@v...]

Sent: Tuesday, August 28, 2001 8:47 AM

To: ASP Web HowTo

Subject: [asp_web_howto] adding up values from a textbox





In my form I have a column that displays the "quantity to ship" amount. 

It's value is pre-populated from a database. There is never a 0 or empty 

record in the textbox. The user can change the amount to ship. When the 

page is submitted I need to be able to take all the textboxes and add them 

all up to get a total of the amount to be shipped. First question, how can 

I do that? Second, here is the catch, each row has a checkbox with it. I 

only want to be able to add up those rows that have been checked.How can I 

do that?



Thanks!!


  Return to Index