Adding Loops to the Sample ProgramIt's time to put our new knowledge of loops into practice. In this section you will add the code to make the Place Order link work. First you need to add a new Web Form to your project. Then you can add the code to calculate the order's grand total. Calculating the total cost isn't difficult. All you need to do is get hold of the ArrayList that contains all the items. Earlier you learned that the sample code stores this ArrayList in the Session object. So we need only retrieve it from the Session object, go through all the items in the list, calculate the price times the quantity, add them all up, and print the value. And that's where loops come in. To add loops to the sample application:
Tips
|